## 27.5 Event Handling (cont.)

- We create an event table out of macros that automatically produce correct code.
- The generic form of the event table is:

  >     BEGIN_EVENT_TABLE(ClassName, BaseClassName)
  >        EVT_TYPE(parameters, function)
  >        . . .
  >     END_EVENT_TABLE()

- There are several different event types; here we use the `MENU` event type that requires a menu ID as a parameter.

  >     BEGIN_EVENT_TABLE(EventFrame, wxFrame)
  >        EVT_MENU(IS_SAY_HELLO, EVentFrame::OnSayHello)
  >     END_EVENT_TABLE()

- We need to insert another macro into the definition of each class that has an event table.

  >     class EventFrame : public wxFrame
  >     {
  >        . . .
  >     private:
  >        wxTextCtrl* text;
  >        DECLARE_EVENT_TABLE()
  >     };

prev |top |next