X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9bd19204037f447e640a7b06829b26216dc7b5e4..7447d53c35249d42128d6243c90998f03882859a:/docs/doxygen/overviews/eventhandling.h diff --git a/docs/doxygen/overviews/eventhandling.h b/docs/doxygen/overviews/eventhandling.h index e671bb84d0..10a1c6543a 100644 --- a/docs/doxygen/overviews/eventhandling.h +++ b/docs/doxygen/overviews/eventhandling.h @@ -3,7 +3,7 @@ // Purpose: topic overview // Author: wxWidgets team // RCS-ID: $Id$ -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// /** @@ -110,7 +110,7 @@ return information is passed via the argument, which is why it is non-const). You also need to insert a macro @code -DECLARE_EVENT_TABLE() +wxDECLARE_EVENT_TABLE() @endcode somewhere in the class declaration. It doesn't matter where it appears but @@ -141,7 +141,7 @@ private: // obligation to do that; this one is an event handler too: void DoTest(wxCommandEvent& event); - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE() }; @endcode @@ -150,12 +150,12 @@ placed in an implementation file. The event table tells wxWidgets how to map events to member functions and in our example it could look like this: @code -BEGIN_EVENT_TABLE(MyFrame, wxFrame) +wxBEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(wxID_EXIT, MyFrame::OnExit) EVT_MENU(DO_TEST, MyFrame::DoTest) EVT_SIZE(MyFrame::OnSize) EVT_BUTTON(BUTTON1, MyFrame::OnButton1) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() @endcode Notice that you must mention a method you want to use for the event handling in @@ -221,9 +221,11 @@ events. @subsection overview_events_bind Dynamic Event Handling +@see @ref overview_cpp_rtti_disabled + The possibilities of handling events in this way are rather different. Let us start by looking at the syntax: the first obvious difference is that you -need not use DECLARE_EVENT_TABLE() nor BEGIN_EVENT_TABLE() and the +need not use wxDECLARE_EVENT_TABLE() nor wxBEGIN_EVENT_TABLE() and the associated macros. Instead, in any place in your code, but usually in the code of the class defining the handler itself (and definitely not in the global scope as with the event tables), call its Bind<>() method like this: @@ -428,7 +430,10 @@ in simple situations where this extra flexibility is not needed. The previous sections explain how to define event handlers but don't address the question of how exactly wxWidgets finds the handler to call for the -given event. This section describes the algorithm used in detail. +given event. This section describes the algorithm used in detail. Notice that +you may want to run the @ref page_samples_event while reading this section and +look at its code and the output when the button which can be used to test the +event handlers execution order is clicked to understand it better. When an event is received from the windowing system, wxWidgets calls wxEvtHandler::ProcessEvent() on the first event handler object belonging to the @@ -454,7 +459,7 @@ doesn't count as having handled the event and the search continues):