How to receive events from grandchildren? Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Petru
Experienced Solver
Experienced Solver
Posts: 62
Joined: Sat Dec 31, 2011 1:05 pm
Contact:

How to receive events from grandchildren?

Post by Petru »

To put the problem simply: Ι've got a wxFrame which contains a wxPanel, which in turn contains some wxButtons. I'm trying to receive wxEVT_COMMAND_BUTTON_CLICKED through the wxFrame.
My current approach is writing this in the wxFrame constructor:

Code: Select all

myPanel->Bind(wxEVT_COMMAND_BUTTON_CLICKED,&MyFrame::OnButtonPress,this,7000,7030);
but without success. Any thoughts? Thank you.
Petru Dimitriu, Romanian. wxWidgets 3.1 on Windows 7 & Ubuntu with MinGW/GCC + CLion
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7477
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: How to receive events from grandchildren?

Post by ONEEYEMAN »

Hi,
You need to bind an event to a button pointer. Something like:

Code: Select all

myButton->Bind(wxEVT_COMMAND_BUTTON_CLICKED,&MyFrame::OnButtonPress,this)
Also, you don't have to give an ID to the function.

Thank you.
Post Reply