How can I handle the 'Apply' button click individually for each property page ?
-
I have two property pages incorporated in a property sheet. Property page 1 has a edit control and property page 2 has a simple push button. I have overridden the OnApply virtual function for both the property pages. When the property sheet is shown, I enable the 'Apply' button by handling EN_cHANGE notification of the edit control for Property page 1. On clicking the 'Apply' button, I show a message defined in overridden OnApply () of Property Page 1 and disable the 'Apply' button by SetModified(FALSE). Then, I go to Property Page 2 tab and click on the button on it to enable the 'Apply' button.Now, I click on the 'Apply' button expecting a message defined in the overridden OnApply() of Property page 2. But, I get the message defined in Property Page 1 first and then get the message in Property page 2. To summarize, On clicking the 'Apply' button while the Property page 2 is active, my control is going into the OnApply() of Property page 1 and then comes into the OnApply() of Property page 2. Why is this happening ? Is this the expected behavior ? Thanks in advance.
-
I have two property pages incorporated in a property sheet. Property page 1 has a edit control and property page 2 has a simple push button. I have overridden the OnApply virtual function for both the property pages. When the property sheet is shown, I enable the 'Apply' button by handling EN_cHANGE notification of the edit control for Property page 1. On clicking the 'Apply' button, I show a message defined in overridden OnApply () of Property Page 1 and disable the 'Apply' button by SetModified(FALSE). Then, I go to Property Page 2 tab and click on the button on it to enable the 'Apply' button.Now, I click on the 'Apply' button expecting a message defined in the overridden OnApply() of Property page 2. But, I get the message defined in Property Page 1 first and then get the message in Property page 2. To summarize, On clicking the 'Apply' button while the Property page 2 is active, my control is going into the OnApply() of Property page 1 and then comes into the OnApply() of Property page 2. Why is this happening ? Is this the expected behavior ? Thanks in advance.
SherTeks wrote:
Why is this happening ? Is this the expected behavior ?
This is perfectly fine. The Apply button is on the property sheet, not any individual page. To borrow a phrase, "what would happen if it only did Apply to the current page?". It's very easy to imagine how things would break down. If you *really* only wanted it to apply to an individual setting on a page, put a button next to that setting, rather than rely on OnApply. Or you could modify all your OnApply's to check if they're the current page. That's less hard that in sounds - you could have each page inherit from a class inheriting from CPropertyPage called CMyPropertyPageThatBreaksUserExpectations. (OK, my opinion is subtly encoded in the name). I hope this helped, Iain.