Creating custom events - Event Handling Overview vs. wxFormBuilder
Vadim Zeitlin
vadim at wxwidgets.org
Wed Feb 20 04:37:24 PST 2008
On Wed, 20 Feb 2008 12:32:37 +0100 Lars Uffmann <aral at nurfuerspam.de> wrote:
LU> And this overview starts talking about macros (DECLARE_EVENT_TYPE,
LU> DEFINE_EVENT_TYPE, BEGIN_EVENT_TABLE, END_EVENT_TABLE) which is really
LU> confusing me:
Don't use them then. In the new code (meaning not caring about wx 2.4
(yes, 4) compatibility) you can just replace these macros with their (often
trivial) expansions as found in wx/event.h.
LU> The GUI code generated by wxFormBuilder doesn't use event
LU> tables, but instead uses virtual event handling functions and in the
LU> class constructor does a wxControl->Connect(...) call to connect an
LU> event handler to a control with a certain event id. I thought I had
LU> understood that part, now I am confused again.
I am certainly confused. You use Connect() for _connecting_ event
handlers, i.e. instead of BEGIN_EVENT_TABLE/EVT_XXX/END_EVENT_TABLE. But it
has nothing to do with defining new events i.e. DECLARE/DEFINE_EVENT_TYPE.
Why do you compare them?
LU> Is it deprecated style to Connect() events?
No. See
http://wxwidgets.blogspot.com/2007/01/in-praise-of-connect.html
LU> And if not, why doesn't the documentation linked above make any mention
LU> of this?
The event overview does mention Connect(), although it should probably do
it more prominently. However I have the impression that you want it to be
mentioned in the section about defining new events and it has simply
nothing to do with it.
Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
More information about the wx-users
mailing list