Different between using a member function directly or sending event using event handler

Skip to first unread message

Sean Mayard

Jun 9, 2022, 4:41:42 AMJun 9
to wx-u...@googlegroups.com
I have a container parent window which has a child window as a data member. Now suppose i've an event handler onClick for the container parent window that receives an wxMouseEvent when the parent window is clicked. Now, suppose I want to send some information, say(x, y) coordinates to the child window. I have 2 options here both of which work:

Option 1:

Create a member function inside the child window that takes two ints and then just call this member function from the event handler onClick of the parent window.

Option 2:

Create an event handler member function for the child window that has some event type as its parameter and then send the event from the parent window event handler onClick to the child window's event handler.

My question is which of the above two methods is  better suited in this situation? I mean, is there an advantage of choosing one over the other? Like maybe the former is blocking while the latter is not. Or some advantages/disadvantages of choosing one over the other that I am unaware of?

I have tried both of them and they both work but I don't know which one to choose. I want to have just one of them instead of having and using them both.

Jason Liam

Jun 9, 2022, 8:47:38 AMJun 9
to wx-u...@googlegroups.com
Please read https://www.wxwidgets.org/support/mlhowto.htm before posting.
You received this message because you are subscribed to the Google Groups "wx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wx-users+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wx-users/CADD_VST3UQ99_JPC%2Bn8zv0OGY053-BGHqagoLjQxM62Bfx%3De6g%40mail.gmail.com.

Sean Mayard

Jun 10, 2022, 6:43:58 AMJun 10
to wx-u...@googlegroups.com
Reply all
Reply to author
0 new messages