Home > Software engineering >  The message is sent to the parent window's parent window
The message is sent to the parent window's parent window

Time:10-10

Window a parent-child relationship is as follows:
Dialog - & gt; The button
Button to dynamically create, in the dialog box member variables have a CButton object associated with it, add button BN_CLICKED message response function, normal response
Parent-child relationships to the following:
Dialog - & gt; Group box - & gt; The button
Response function is added in the dialog box class, there is no response, the group box cut away the news?
If so, how to deal with, don't want to put the group box to inherit a subclass, and then the message map
Is there any way to the news of the group box turn again to the dialog

CodePudding user response:

Sendmessage to the window need to send a message,

CodePudding user response:

Either you don't set the CButton father to grouping, control notification will only be passed to the parent class, you can set CButton father for Dialog box, or you in the combo box after receiving the BN_CLICKED forwarded to Dialog, through pDialog - & gt; SendMessage (WM_COMMAND, MAKEWPARAM (IDC_BUTTON, BN_CLICKED), 0).

CodePudding user response:

refer to the second floor pcradio response:
or you don't set the CButton father to grouping, control notification will only be passed to the parent class, you can set CButton father for Dialog box, or you in the combo box after receiving the BN_CLICKED forwarded to Dialog, through pDialog - & gt; SendMessage (WM_COMMAND, MAKEWPARAM (IDC_BUTTON, BN_CLICKED), 0).


Then where do I call this function, should or overloading of the combo box OnClick function?

CodePudding user response:

reference SSDLW reply: 3/f
Quote: refer to the second floor pcradio response:

Either you don't set the CButton father to grouping, control notification will only be passed to the parent class, you can set CButton father for Dialog box, or you in the combo box after receiving the BN_CLICKED forwarded to Dialog, through pDialog - & gt; SendMessage (WM_COMMAND, MAKEWPARAM (IDC_BUTTON, BN_CLICKED), 0).


Then where do I call this function, should or overloading of the combo box OnClick function?

Right, do ON_BN_CLICKED response in the combo box, and then forwarded to the Dialog

CodePudding user response:

I'm not even add a new class inherits from the combo box? The key is to don't want to do so, is there any mechanism to let the message directly to the parent window again to his own parent window?

CodePudding user response:

There is also a more pull phenomenon, the following parent-child structure
Dialog - & gt; Combo box - & gt; A normal radio, Windows 7
Under the XP if use classical style also normal

Classic style

But XP style

XP style

Lite version of XP themes have what problem, I use VS2013

CodePudding user response:

No one in this case?
  • Related