|
-
May 10th, 1999, 09:33 AM
#1
Property pages... How can I know when one page has never been showed ?
Hi,
I have a little problem with property sheets/pages:
I have some variables that I need to share from the pages to my property sheet, but the problem is when one page is never selected then its variables has garbage, Is there any way to know if one property page has been initialized ( showed at least one time) ?
I have tried to, to initialize all the pages ( with the Premature flag), but gives me a compiler error, don't recognizes this flag ! ( I'm using 5.0).
Anybody can help me ? Thanks, Bye !
Braulio
-
May 10th, 1999, 09:44 AM
#2
Re: Property pages... How can I know when one page has never been showed ?
try using counter variable for each page
-
May 10th, 1999, 10:11 AM
#3
Thanks But...
Thanks But...
What you told me is to put member variables on the property sheet, and on the InitDialog of every page when is called put the variables to TRUE.
I think this will work, but is a little bit bad that MFC doesn't has anything for this thing ( i think that is a normal thing, sometimes you need to know before close wich thing has been modified or not, or...), but... "**** happens" ;-)
Thanks, Bye !
Braulio
-
May 12th, 1999, 04:56 PM
#4
Re: Thanks But...
Simple!
Just derive your own CMyPropertyPage from CPropertyPage, and then
derive the member function
CPropertyPage::OnSetActive() which is called when a page is entered
Use a Boolean Variable for each Page to indicate it has been shown or not.
Uli
-
May 12th, 1999, 08:49 PM
#5
Re: Property pages... How can I know when one page has never been showed ?
Check to see if the page's HWND is non zoer or not, that should indicate if the page has been shown or not...
Sally
-
May 13th, 1999, 10:06 AM
#6
Thanks !, Good idea !
Thanks,
Good Idea !
Bye
Braulio
-
May 13th, 1999, 12:11 PM
#7
Re: Property pages... How can I know when one page has never been showed ?
You should always supply default values to those variables, and they should be set in the pages themselves. For example, if you have two pages that each have two edit boxes, you should do the following:
CMySheet sheet;
CMyPage1 page1;
CMyPage2 page2;
CString s1 = "Foo";
CString s2 = "Bar";
CString s3 = "Hello";
CString s4 = "World";
page1.edit1 = s1;
page1.edit2 = s2;
page2.edit1 = s3;
page2.edit2 = s4;
sheet.AddPage(page1);
sheet.AddPage(page2);
if (IDOK == sheet.DoModal())
{
s1 = page1.edit1;
s2 = page1.edit2;
s3 = page2.edit1;
s4 = page2.edit2;
}
This way, all the variables on all your pages have valid values when the user clicks "OK", and you don't have to worry about whether or not the page has been accessed. Anyway, I hope this helps! Good luck, and happy coding.
=================================================
Valerie L. Bradley
Software Engineer
Intel Corporation
* All opinions expressed are mine and not those of my employer.
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
|