WxWindow

From WxWiki

Revision as of 21:54, 13 May 2007 by 212.166.228.161 (Talk)
Jump to: navigation, search

Contents

GetChildren

wxWindow::GetChildren() returns wxWindowList&, not wxList&. I got a warning at compile time when doing:

wxList& mylist = pWindow->GetChildren();

The warning was: [Warning] `operator 5' is deprecated (declared at C:/Dev-Cpp/include/wx-2.6/wx/list.h:1112)

Replacing wxList& with wxWindowList& fixed it.

RegisterHotKey

Eric Jensen writes on wx-users::

i was playing around with wxWindow::RegisterHotKey() and noticed that        
the virtualKeyCode parameter that this function uses, expects the           
Window keycodes and not the wxWidgets keycodes (e.g VK_F9 rather             
than WXK_F9).                                                              
                                                                            
Although this was not difficult to find, it should be mentioned in the       
documetation. However, if this function ever gets implemented on other     
platforms, using the 'normalized' wxWidgets keycode might become             
necessary.

EVT_WINDOW_CREATE

Your wxWindow-derived class will not receive this event if you create the window by calling the wxWindow constructor (as in MyWin::MyWin(wxWindow*parent) : wxWindow(parent,...)) because your object is still a wxWindow when the window is created. Call Create(parent,...) from the body of your constructor instead.

Also, don't try to receive EVT_WINDOW_DESTROY events in your own window, as is well documented in the official docs. Override Destroy() instead.

EVT_LEFT_DOWN

If you handle this event, as well as EVT_RIGHT_DOWN or EVT_MIDDLE_DOWN, and do not call event.Skip() you will most likely want to call SetFocus(). Failure to do so will prevent the window from receiving keyboard and mouse wheel events.

Personal tools