InterviewSolution
| 1. |
How Are Multiple Evt_xxx Calls Handled? |
Answer»
Each instance of a class DERIVED from wxEvt Handler has a static event table, which is used only by C++ code, and a dynamic event table (just a list really) which is what wxPython uses although a few C++ developers use it too. Every time you call a EVT_XXX function it adds an ENTRY to this list. When an event happens the first matching handler in the event table is called, and if it calls event.Skip() then the search continues so if another match is found then it is called too. The EVT_XXX functions are really just convenience wrappers around the wxEvt Handler.Connect method. There is ALSO a .Disconnect method that you can call if needed to remove an event handler binding. Each instance of a class derived from wxEvt Handler has a static event table, which is used only by C++ code, and a dynamic event table (just a list really) which is what wxPython uses although a few C++ developers use it too. Every time you call a EVT_XXX function it adds an entry to this list. When an event happens the first matching handler in the event table is called, and if it calls event.Skip() then the search continues so if another match is found then it is called too. The EVT_XXX functions are really just convenience wrappers around the wxEvt Handler.Connect method. There is also a .Disconnect method that you can call if needed to remove an event handler binding. |
|