Click to See Complete Forum and Search --> : about PropertySheet DDX
August 24th, 1999, 02:43 AM
PropertySheet do DDX automatically when pages changed or OK clicked,
but I need know which page is selected just before I click OK and
only this page's data are needed, how can I ?
Rail Jon Rogut
August 24th, 1999, 02:51 AM
How about CPropertySheet::GetActivePage()?
Rail
------------
Recording Engineer/Software Developer
Rail Jon Rogut Software
http://home.earthlink.net/~railro/
railro@earthlink.net
1st.app
August 24th, 1999, 03:37 AM
Should I overload DDX for PropertySheet?
I cann't find OnOK of it.
Rail Jon Rogut
August 24th, 1999, 04:20 AM
There is an OnOK() for each of your Property Pages -- so if you add a handler for the OnOK() in each page, then you won't have to worry about finding out which page is the active page with GetActivePage() because that page's handler for OnOK() will be called.
If you want to handle the OK button from your CPropertySheet derived class, then add a command handler for OnCommand()
BOOL CMySheet::OnCommand(WPARAM wParam, LPARAM lParam)
{
if (wParam == IDOK)
OnSheetOK();
return CPropertySheet::OnCommand(wParam, lParam);
}
and create a member function which you call when the OK button is pressed:
void CMySheet::OnSheetOK(void)
{
int iIndex;
iIndex = GetPageIndex(GetActivePage()); // Gets the index of the current page
// Page 0 is the first page
// Do something
}
Rail
------------
Recording Engineer/Software Developer
Rail Jon Rogut Software
http://home.earthlink.net/~railro/
railro@earthlink.net
1st.app
August 25th, 1999, 02:11 AM
It seems PropertySheet atomatically call all OnOK of the pages have been switched, since page0 is the default page, it's OnOK is always called.
replika
August 25th, 1999, 03:11 AM
Your last post is a little unclear but:
If you want to skip the default implementation of the "OK"-button just override OnCommand and handle it yourself as explained by Jon and return TRUE, like:
BOOL CMyPropSheet::OnCommand(WPARAM wParam, LPARAM lParam)
{
switch(wParam)
{
case IDOK:
//Handle OK here
return TRUE; //skip default implementation
default:
break;
};
return CPropertySheet::OnCommand(wParam, lParam);
}
Hope this isn't competely off-topic!
Good luck!
replika
August 25th, 1999, 03:13 AM
I made a grave mistake. Disregard that last post :(
Rail Jon Rogut
August 25th, 1999, 03:56 AM
Could you give me your objective, so I could try and get a feel for what you're ultimately trying to achieve.
In the example that I posted - if the second page is Active when the user presses the IDOK button, then the value for iIndex is 1.
Thanks.
Rail
------------
Recording Engineer/Software Developer
Rail Jon Rogut Software
http://home.earthlink.net/~railro/
railro@earthlink.net
1st.app
August 25th, 1999, 10:44 PM
to make a property sheet, each tab has its own function, like this:
when select first page and click OK, the program draw a box use the data in the first page;
when slect the second page and click OK, it draw a sphere use the data in the second page, etc.
I think it's easy, but always confused.
Thanks,
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.