Home > Software engineering >  MFC generated dynamically control and in the children group box, how to set up for its processing ev
MFC generated dynamically control and in the children group box, how to set up for its processing ev

Time:09-28

See each elder code, if will dynamically generated controls in the dialog class, you can set the incident, but if placed in the inside of the dialog container children group box, for example, event failure,
 
BEGIN_MESSAGE_MAP (Cbms_setupDlg CDialogEx)
ON_WM_PAINT ()
ON_WM_QUERYDRAGICON ()
ON_WM_CLOSE ()
ON_COMMAND_RANGE (C_BTN_LINE_ID C_BTN_LINE_ID + 99, & amp; Cbms_setupDlg: : OnLineItemClick)
ON_CONTROL_RANGE (BN_CLICKED C_BTN_AREA_ID, C_BTN_AREA_ID + 2, & amp; Cbms_setupDlg: : OnAreaItemClick)
ON_BN_CLICKED (IDCANCEL, & amp; Cbms_setupDlg: : OnBnClickedCancel)
END_MESSAGE_MAP ()
.
Size_t lvnBtnCount=lvvsAreas. The size ();
MAreaBtns=new CButton [lvnBtnCount];
DWORD dwStyle=WS_CHILD | WS_VISIBLE | BS_COMMANDLINK;
String * lvlpsAreas=& amp; LvvsAreas [0].
For (size_t I=0; I & lt; LvnBtnCount; I++) {
Wstring lvsTitle=freestyle: : StrUtils: : s2ws (lvlpsAreas [I]);
MAreaBtns [I]. Create (lvsTitle. Data (), dwStyle, CRect (20 + 250 * I, 30, 180 + 250 * I, 70), & amp; CmgArea C_BTN_AREA_ID + I);
+ I);

}

The above code, if the parent this for cmgArea (group box), event failure, should be BEGIN_MESSAGE_MAP here to additional processing, don't know how to do?

CodePudding user response:

I also each and concrete done,
But I suggest you in baidu search "MFC generated dynamically control message map event handling"

CodePudding user response:

each and -> no

CodePudding user response:

reference 1st floor zhao4zhong1 response:
I also each and concrete done,
But I suggest you in baidu search "MFC generated dynamically control message map event handling"


Won't you? I am looking for a long time, didn't involve the specific application, data should be to install it with the container is the most commonly used...

CodePudding user response:

As far as I know, is not usually put RadioButton or CheckBox groupbox?

CodePudding user response:

Don't have to change the parent of this into "cmgArea (group box)"

CodePudding user response:

Control of events generally transmitted to its parent window, if you point to the parent window is Group control, nature should be handled by the Group control

CodePudding user response:

refer to 6th floor zgl7903 response:
control events generally transmitted to its parent window, if you point to the parent window is Group control, nature should be handled by Group control


But I want to use the group box will dynamically generated control grouping management, if not to replace this with groupbox class variables, still have what good method?

CodePudding user response:

reference 5 floor schlafenhamster reply:
don't have to "change the parent of this into cmgArea (group box)"

If I want to use the group box will dynamic control grouping management, general should be how to deal with?

CodePudding user response:

The
reference 4 floor zhao4zhong1 reply:
as far as I know, is not usually put RadioButton or CheckBox groupbox?


The same, the radiobutton/checkbox is placed in groupbox should also can't accept the message, worry now are don't know how to write the message map.
Suddenly remembered before sleep last night or how automatically generated code, today to get up in the dialog to pull a group box, and then trying to pull a button to the group box, but how to make the button of the parent or the dialog.
just transfer from Delphi to vc soon, this is really difficult to adapt to the...

CodePudding user response:

A little bit more simple operation, don't be created dynamically, the resource editor to edit, layout is easier to control

CodePudding user response:

references to the tenth floor zgl7903 response:
a little bit more simple operation, don't dynamically created, in the resource editor to edit the good, the layout is easier to control

The content of the button and quantity from the server...
And, could you tell me how to set the button/checkbox these controls are added to the group box container?

CodePudding user response:

Derive your groupbox (in fact is the static)
  • Related