-
December 3rd, 2018, 05:35 PM
#1
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.
-
December 4th, 2018, 02:34 AM
#2
Re: Organizing Buttons Event Handlers in another class doesn't working
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.
Victor Nijegorodov
-
December 4th, 2018, 08:10 AM
#3
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?
-
December 4th, 2018, 02:38 PM
#4
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.
-
December 4th, 2018, 03:34 PM
#5
Re: Organizing Buttons Event Handlers in another class doesn't working
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!
Victor Nijegorodov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|