Click to See Complete Forum and Search --> : Property sheet before close ask...
Braulio
May 6th, 1999, 04:16 AM
Hi !,
I have a property sheet, and I want that when the users presses over the close button of the window, ask if he really want to close the window ( without save, bla bla...), I have tried with OnCancel Method and with Close method, but none of this methods are called when I debug the application, anybody can help me ?
Thanks, Bye !
Braulio
BrianOG
May 6th, 1999, 05:09 AM
In CPropertyPage there is a overridable called OnQueryCancel. This is called by the propertysheet when a user click the Cancel / Close button. If you catch this for each of your property pages you could call into a function in your CPropertySheet class to do some validation before closing.
Braulio
May 6th, 1999, 06:45 AM
Thanks, but...
I would like to let the user the chance of not close the property sheet ( is something like "Loose changes ? Yes/No", and if it's no keep on showing the property sheet.
Can you help me a little bit more ? , Thanks, Bye !
Braulio
BrianOG
May 6th, 1999, 06:51 AM
yes, you return false from the OnQueryCancel and the property sheet dont close.
Braulio
May 6th, 1999, 07:21 AM
Thanks but...
I have taked one page and I have return FALSE always, to see if the property sheet is not closed, but is closed...
What have I made wrong ? Thanks, Bye !
Braulio
BrianOG
May 6th, 1999, 07:30 AM
In your PropertySheet derived class (if you have one) add a function to validate the close.BOOl CMyPropertySheet::OkToClose()
{
return m_bOkToClose;
}
Then in each of your propertypages override OnQueryCancel and do something like this:BOOL CMyPropPage1::OnQueryCancel()
{
CMyPropertySheet *pPropSheet = (CMyPropertySheet *)GetParent();
return pPropSheet->OkToClose();
}
and this should do it for u.
Note, I assume you are trying to catch this on the Close/Cancel button and not OK, or Finish or whatever....
Braulio
May 6th, 1999, 07:44 AM
Hi,
Thanks, now works !, I didn't knew that I had to return FALSE in all the pages, Thanks, Bye !
Braulio
BrianOG
May 6th, 1999, 07:47 AM
Neither did I but it was worth a try :-)
Actually I think it might only be the page that is active when you try to close the sheet. But seeing as you dont know which page will be active you have to check in all pages.
Brian
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.