WxWidgets custom events

Posted by Klaus on Stack Overflow See other posts from Stack Overflow or by Klaus
Published on 2010-04-25T17:21:10Z Indexed on 2010/04/25 17:23 UTC
Read the original article Hit count: 239

Filed under:
|
|

Hello,

I'm trying to use a custom event in my WxWidgets C++ application, like described here.

In the constructor of my wxApp:

Connect(wxID_ANY, wxCommandEventHandler(APP::OnMyEvent));

Then the function that should catch the event:

void APP::OnMyEvent(wxCommandEvent& event)
{
    exit(0); //testing
}

Finally, to test it:

wxCommandEvent MyEvent(wxEVT_COMMAND_BUTTON_CLICKED); 
wxPostEvent(this, MyEvent);

I launch the thing...but it seems that the event is not posted or not caught.

Does someone understand this behaviour ?

© Stack Overflow or respective owner

Related posts about wxwidgets

Related posts about c++