-
October 15th, 2000, 06:46 AM
#1
Font Dialog...
Hi there! Can anyone tel me how do I "PRESERVE" the CFontDialog settings after the user has closed it after editing the font styles and later when he open it for the 2nd time, the same settings will appear again? Thanks!(I've an SDI PROGRAM)
THanks!
Xeon
"Hell is calling for you!" - Rufus, from Valkyrie Profile 2 : Silmeria
"I'm getting tired of you devils.....finishing strike......Final Blast!" - Arngrim, from Valkyrie Profile 2 : Silmeria
-
October 15th, 2000, 07:16 AM
#2
Re: Font Dialog...
You can save CFontDialog::m_cf and for 2nd time use it before DoModal(). I don't suggest to copy it directly. You have to decide by yourself, which fields to copy.
-
October 15th, 2000, 07:28 AM
#3
Hi IgBrus!
Hi thanks! I know the steps u mentioned, but how what kinda variable can I use to save the CFontDialog::m_cf?
I code something like belowin an SDI program)
//this code is coded in the WM_COMMAND message handler of one of the toolbar button to show the CFontDialog.
CFontDialog fontDialog;
fontDialog.m_cf.lLogFont = m_StoredFont; //m_StoredFont is of type LOGFONT declared in the class definiton.
if(fontDialog.DoModal()==IDOK)
{
//...apply the changes....
m_StoredFont = fontDialog.m_cf.lLogFont;
}
As you can see, I always get an error or 2, and the thing doesn't work. Thanks!!!(I wanted to save the settings of the m_cf.lLogFont member)
"Hell is calling for you!" - Rufus, from Valkyrie Profile 2 : Silmeria
"I'm getting tired of you devils.....finishing strike......Final Blast!" - Arngrim, from Valkyrie Profile 2 : Silmeria
-
October 16th, 2000, 03:15 AM
#4
Re: Hi IgBrus!
m_cf hasn't LOGFONT field, bat has pointer to logfont field. So I suggest something as
CFontDialog fontDialog;
fontDialog.m_cf.Flags |= CF_INITTOLOGFONTSTRUCT;
fontDialog.m_cf.lpLogFont = new LOGFONT;
*(fontDialog.m_cf.lpLogFont) = m_StoredFont; //m_StoredFont is of type LOGFONT declared in the class definiton.
if(fontDialog.DoModal()==IDOK)
{
//...apply the changes....
m_StoredFont = *(fontDialog.m_cf.lpLogFont);
}
delete fontDialog.m_cf.lpLogFont;
-
October 16th, 2000, 05:43 AM
#5
Thanks a lot!
Hi there! I've rated u 2 EXCELLENTS for each of ya' help. But here's a question for the current post:
*(fontDialog.m_cf.lpLogFont) = m_StoredFont;
What is the '*' doing here? Thanks!(help me & you'll get another EXCELLENT!)
"Hell is calling for you!" - Rufus, from Valkyrie Profile 2 : Silmeria
"I'm getting tired of you devils.....finishing strike......Final Blast!" - Arngrim, from Valkyrie Profile 2 : Silmeria
-
October 16th, 2000, 05:51 AM
#6
Re: Thanks a lot!
1.Thanks for rating, but you know: we are here for the help, not for rating. Friends haven't to pay to friends. Anyway thanks oncemore for your evaluation of my efforts.
2. Because m_cf.lpLogFont is pointer to LOGFONT object and m_StoredFont is LOGFONT, we apply * and default assignment operator. It has the same effect as
memcpy(fontDialog.m_cf.lpLogFont, &m_StoredFont, sizeof(LOGFONT));
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|