|
GuideToPorting
Differences between C++ and BlitzMax wxWidgets applications
to do... |
► Sign in to add a comment
|
|
|
Search
|
|
GuideToPorting
Differences between C++ and BlitzMax wxWidgets applications
to do... |
Introduction
Event Handling
The usual method in a C++ app is to use an event table, defined statically, using macros, along the lines of :
BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(wxID_EXIT, MyFrame::OnQuit) EVT_MENU(wxID_ABOUT, MyFrame::OnAbout) END_EVENT_TABLE()In BlitzMax, we instead use Connect() to attach a specific event to a callback function:
Connect(wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED, OnQuit) Connect(wxID_ABOUT, wxEVT_COMMAND_MENU_SELECTED, OnAbout)They essentially do exactly the same job, except that the event table is fixed and we can Connect/Disconnect at any time.
You can look at the EventMappings to see how each macro can be employed by an equivalent Connect call.