CPropertyPage Brain Fart!!!
-
Hi, Looks like I'm having a brain fart this morning and can't remember how to cancel the closing of a property sheet. I have two property pages, and I validate some settings in the CMyPropPage1::OnOk() handler. If the settings are invalid, I display a msgbox to the user and want to leave the property sheet displayed. However, it's closing after the user closes the msgbox! When the settings are invalid, I simply return from the handler (which appears to be wrong...). So, what do I have to do to keep it displayed?? Thanks! Chris _"No one goes to hell because of their sin, but because of rejecting God's method of salvation: His Son's life for yours..."
"It does not take a majority to prevail ... but rather an irate, tireless minority, keen on setting brushfires of freedom in the minds of men." --Samuel Adams_
-
Hi, Looks like I'm having a brain fart this morning and can't remember how to cancel the closing of a property sheet. I have two property pages, and I validate some settings in the CMyPropPage1::OnOk() handler. If the settings are invalid, I display a msgbox to the user and want to leave the property sheet displayed. However, it's closing after the user closes the msgbox! When the settings are invalid, I simply return from the handler (which appears to be wrong...). So, what do I have to do to keep it displayed?? Thanks! Chris _"No one goes to hell because of their sin, but because of rejecting God's method of salvation: His Son's life for yours..."
"It does not take a majority to prevail ... but rather an irate, tireless minority, keen on setting brushfires of freedom in the minds of men." --Samuel Adams_
Well when OnOK is called in the PropertySheet all the PropertyPageses that have been activated get their OnOK called. That means all the pages have been validated; therefor, no matter what the return is from OnOK on the Sheet it will close. Al least that is my experiance. It may be totally incorrect but it is what I tell myself to feel better. :) So what do you do? In all my PropertySheets I validate at the Page level. That way if a page fails then I show message and return there. Hope it helps. *********************** Tony Fontenot Recreational Solutions tony@recsolutions.com ***********************