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
Re: Property pages... How can I know when one page has never been showed ?
try using counter variable for each page
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
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.