Reporting Property Page Button to Parent Dialog
-
I am looking for help in understanding how to have a parent dialog be made aware of button presses that occur from buttons that are pressed on the panes of a property sheet. I already have code in the classes, for each of the property pages, that gets attention when each of these buttons is pressed. I have that code in the property page class becasue some information from the page controls needs to be gathered and then the parent dialog needs to know this information. The parent dialog uses this to change an edit control contents that is on the dialog outside the client area of the property sheet. What is the method to report this information out to the parent dialog? MIKE
-
I am looking for help in understanding how to have a parent dialog be made aware of button presses that occur from buttons that are pressed on the panes of a property sheet. I already have code in the classes, for each of the property pages, that gets attention when each of these buttons is pressed. I have that code in the property page class becasue some information from the page controls needs to be gathered and then the parent dialog needs to know this information. The parent dialog uses this to change an edit control contents that is on the dialog outside the client area of the property sheet. What is the method to report this information out to the parent dialog? MIKE
This is far from standard, but you can try the following:
- Go to the source code for your propery page and replicate the handler declaration in your property sheet (the message map stuff, you know).
- In
CYourPropertyPage::OnButtonClicked
propagate the message at the end of the handler withGetParent()->SendMessage(WM_COMMAND,MAKEWPARAM(ID_BUTTON,BN_CLICKED),(LPARAM)m_hWnd)
. - Do whatever you need to in
CYourPropertySheet:OnButtonClicked
.
Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
-
This is far from standard, but you can try the following:
- Go to the source code for your propery page and replicate the handler declaration in your property sheet (the message map stuff, you know).
- In
CYourPropertyPage::OnButtonClicked
propagate the message at the end of the handler withGetParent()->SendMessage(WM_COMMAND,MAKEWPARAM(ID_BUTTON,BN_CLICKED),(LPARAM)m_hWnd)
. - Do whatever you need to in
CYourPropertySheet:OnButtonClicked
.
Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
Thanks for your reply. Your suggestion game me an idea to try. Instead of cloning the handler and the message table I can see (from a debuggger trace) that within the button handler of the property page I can use GetParentOwner() to get the CWnd* of the parent dialog. Using this I can send a message right to the base dialog. I do have yet to work out just what message to send. I would like there to be a single handler in the base dialog for all of the various buttons on the proprety pages. Due to this I inclined to look into the WM_NOTIFY scheme or to otherwise use the ON_REGISTERED_MESSAGE() macro mechanism inthe message map and make a custom message type via a registration with windows. Mike