Organizing Buttons Event Handlers in another class doesn't working
Hi,
I have started a clean MFC proiect with dialog based option with CWinApp base class.
I want to organize event handlers functions for buttons in other class that in the main dlg class, but the buttons event handlers that are assigned to the class that I want to use, aren't trigger, the innterupts that are setted to their button click function aren't triggered.
If I put the event handlers in the dlg class it's working, but I want to organize in other class, how can I do that?
Thank you in advance.
Re: Organizing Buttons Event Handlers in another class doesn't working
Quote:
Originally Posted by
coco243
...
I want to organize event handlers functions for buttons in other class that in the main dlg class...
Why " in other class"?
Control notifications are usually sent to the parent window of the control which in your case is the dialog containing the buttons.
Re: Organizing Buttons Event Handlers in another class doesn't working
Victor is right in that that's a bad design. What does your message map look like? How are you trying to get this other class to handle your dialog's messages?
Re: Organizing Buttons Event Handlers in another class doesn't working
Thank you guys for your attention.
Yes, you opened my eyes. The functions from button handlers should be in the dialog class. ( I had looked in other programs that I have as example and I understood what you
are trying to explain to me.) I will call the functions that I need from dialog class and try to organize this functions in a separated class.
I think that it had no sense trying in this direction.
Thank you very much.
Re: Organizing Buttons Event Handlers in another class doesn't working
Quote:
Originally Posted by
coco243
Thank you guys for your attention.
Yes, you opened my eyes. The functions from button handlers should be in the dialog class. ( I had looked in other programs that I have as example and I understood what you
are trying to explain to me.) I will call the functions that I need from dialog class and try to organize this functions in a separated class.
I think that it had no sense trying in this direction.
Thank you very much.
You are welcome! :)