Catching clicking
-
Hi all, i have a modal dialog. i've created a button in run-time using new operator to CButton class, and then Create; my question is i want the dialog to catch the pressing of the button or other buttons created at run-time for that matter..... how to do that??? i know i need to use reflection or something like that.. i would like to see some sample code .... Thanks in advanced Yaron Ask not what your application can do for you, Ask what you can do for your application
-
Hi all, i have a modal dialog. i've created a button in run-time using new operator to CButton class, and then Create; my question is i want the dialog to catch the pressing of the button or other buttons created at run-time for that matter..... how to do that??? i know i need to use reflection or something like that.. i would like to see some sample code .... Thanks in advanced Yaron Ask not what your application can do for you, Ask what you can do for your application
It's to my understanding that message reflection is MFC compile time only. If your creating windows dynamically I don't think there is a way to map handlers using macros :) So I would suggest probably using
OnCommand()
and using an if statement:MyDialog::OnCommand( WPARAM wParam, LPARAM lParam )
{
if(LOWORD(wParam) <= IDC_DNYCTRL_FIRST && LOWORD(wParam) >= IDC_DNYCTRL_LAST)
// Handle any button click within a range of values
}HTH Cheers :) I'm drinking triples, seeing double and acting single :cool:
-
It's to my understanding that message reflection is MFC compile time only. If your creating windows dynamically I don't think there is a way to map handlers using macros :) So I would suggest probably using
OnCommand()
and using an if statement:MyDialog::OnCommand( WPARAM wParam, LPARAM lParam )
{
if(LOWORD(wParam) <= IDC_DNYCTRL_FIRST && LOWORD(wParam) >= IDC_DNYCTRL_LAST)
// Handle any button click within a range of values
}HTH Cheers :) I'm drinking triples, seeing double and acting single :cool:
Hockey wrote: if(LOWORD(wParam) <= IDC_DNYCTRL_FIRST && LOWORD(wParam) >= IDC_DNYCTRL_LAST) Shouldn't this be:
if(LOWORD(wParam) <= IDC_DNYCTRL_LAST && LOWORD(wParam) >= IDC_DNYCTRL_FIRST)
Five birds are sitting on a fence. Three of them decide to fly off. How many are left?
-
Hockey wrote: if(LOWORD(wParam) <= IDC_DNYCTRL_FIRST && LOWORD(wParam) >= IDC_DNYCTRL_LAST) Shouldn't this be:
if(LOWORD(wParam) <= IDC_DNYCTRL_LAST && LOWORD(wParam) >= IDC_DNYCTRL_FIRST)
Five birds are sitting on a fence. Three of them decide to fly off. How many are left?
Something like that :) I must have typed it with my eyes closed I'm drinking triples, seeing double and acting single :cool:
-
Hi all, i have a modal dialog. i've created a button in run-time using new operator to CButton class, and then Create; my question is i want the dialog to catch the pressing of the button or other buttons created at run-time for that matter..... how to do that??? i know i need to use reflection or something like that.. i would like to see some sample code .... Thanks in advanced Yaron Ask not what your application can do for you, Ask what you can do for your application
Add a button on the dialog use dialog editor, and appoint the same ID as you call CButton::Create.Than you can add message handler for that button.After a the message handler has been added, you can delete that button on the dialog, and create it at run-time. Note:using the same ID is crucial. This is very tricky techniques.
-
Hi all, i have a modal dialog. i've created a button in run-time using new operator to CButton class, and then Create; my question is i want the dialog to catch the pressing of the button or other buttons created at run-time for that matter..... how to do that??? i know i need to use reflection or something like that.. i would like to see some sample code .... Thanks in advanced Yaron Ask not what your application can do for you, Ask what you can do for your application
Hi Yaron, wouldn't help you to create your button within the dialog editor and hide/show it with ShowWindow(TRUE/FALSE)? Bunburry