wxWidgets 2.4.2, wxMSW version I'm trying to register events from a task bar icon that i want to handle in the main frame of the app, but the connection just doesn't work.
event table is
BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_CLOSE(Minimal_Quit, MyFrame::OnQuit) EVT_TIMER(Timer_ID, MyFrame::OnTimer) EVT_ICONIZE(MyFrame::OnIconize) EVT_TASKBAR_LEFT_UP(MyFrame::OnSwitchIconize) EVT_TASKBAR_RIGHT_DCLICK(MyFrame::OnClose) END_EVENT_TABLE() but OnSwitchIconize and OnClose are never called.
Both functions are declared as follows in the header file: class MyFrame : public wxFrame { public: void OnClose(wxTaskBarIconEvent & event); void OnSwitchIconize(wxTaskBarIconEvent & event); } Is there a mistake? Should i derive MyFrame from wxTaskBarIcon?
Hi! Derive your taskbaricon from wxTaskBarIcon, do the event handling in you dervied class and create the new class in your frame. Check the "taskbar" sample for a way to do that. http://g.yi.org/f.php?f=7880
upCASE ----------------------------------- If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
3. Re: wxTaskBarIconEvent
#4681
Posted by: 2004-06-30 00:27:24
Thanks. I had noticed that thing in the example, but being a bit lazy i didn't want to bother with that ;) (i'm porting an app from Py/wxPy to C++/wxW and wxPy allows you to handle TaskBarIconEvents into the app frame, which is why i was trying it that way)