How do I know which event type to use?

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
ReddishShift
In need of some credit
In need of some credit
Posts: 8
Joined: Tue Mar 30, 2021 11:31 pm

How do I know which event type to use?

Post by ReddishShift »

I'm only just starting with wxWidgets, and don't see any straight forward information on what event type I should use in a Bind statement.

For example, I wanted to do some processing when the text in a wxTextCtrl is changed by the user. I googled around and found out I want wxEVT_COMMAND_TEXT_UPDATED, but I can't see anywhere this is documented in a straight forward way. For instance searching the wxwidgets.org documentation for wxEVT_COMMAND_TEXT_UPDATED produces no results.

Am I misunderstanding something?
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: How do I know which event type to use?

Post by PB »

You know you are interested in an event generated by a wxTextCtrl, so you go to its docs:
https://docs.wxwidgets.org/trunk/classwx_text_ctrl.html

There is a section named "Events emitted by this class" and looking at the four events listed, it is pretty clear that wxEVT_TEXT is the one.

If you search wxWidgets include folder, you will find that wxEVT_COMMAND_TEXT_UPDATED is the old and no longer used alias for wxEVT_TEXT:
https://github.com/wxWidgets/wxWidgets/ ... trl.h#L923

BTW, when wanting to know how to use a wxWidgets class, it is often useful to look at the source of a bundled sample showing it off, here "text".
DavidHart
Site Admin
Site Admin
Posts: 4252
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: How do I know which event type to use?

Post by DavidHart »

Hi,

See this wxWiki page: it links to a page that you should find helpful. In particular you'll find wxEVT_COMMAND_TEXT_UPDATED in a list of aliases, preceded by the comment:
"These aliases are new in 3.0. Various event-types of the form 'wxEVT_COMMAND_*' are now 'wxEVT_*'. The old forms still exist and are likely to do so for a long time. However new code should use the new form."

If for some reason you're still using wx2.8, there's a link there for that too.

Regards,

David
Post Reply