Lists of wxEventTypes

From WxWiki
Jump to: navigation, search

The documentation for a wx control often discusses any wxEvents that are specific to it, and lists their event-table macros. However it's less common for the corresponding wxEventTypes to be provided, and it's those (and the appropriate handler cast e.g. wxCommandEventHandler) that are needed to catch events using wxEvtHandler::Bind and wxEvtHandler::Connect. As a result, "Which event-type do I need to catch for..." is a frequently asked question on #wxwidgets, and is getting commoner as more people use dynamic event-binding.

So here are tables of all the official wxEventTypes to be found in the headers, with their event table macros and handler casts listed alongside. At the bottom there are separate tables for event-range macros, generic macros and obsolete types. The one for 'wx stable' (currently 3.0) is here. This one is for wx2.8 (taken from wx2.8.12).

Note that there is no mention here of wxEvent classes: see here to discover the difference between wxEvent and wxEventType.

The data was extracted from the headers and formatted using this 'flex' input file (the gawk script, which I originally used, had missed lots of macros). With it (if you run Linux) you can produce lists for other wx versions, either to put here or play with at home. If you find any errors or omissions, please edit the file rather than just the tables; otherwise next time, your changes will have to be reapplied by hand (or more likely overwritten).