Contents Up Previous Next

wxUpdateUIEvent

This class is used for pseudo-events which are called by wxWindows to give an application the chance to update various user interface elements.

Derived from

wxCommandEvent
wxEvent
wxObject

Include files

<wx/event.h>

Event table macros

To process an update event, use these event handler macros to direct input to member functions that take a wxUpdateUIEvent argument.

EVT_UPDATE_UI(id, func) Process a wxEVT_UPDATE_UI event for the command with the given id.
EVT_UPDATE_UI_RANGE(id1, id2, func) Process a wxEVT_UPDATE_UI event for any command with id included in the given range.
Remarks

Without update UI events, an application has to work hard to check/uncheck, enable/disable, and set the text for elements such as menu items and toolbar buttons. The code for doing this has to be mixed up with the code that is invoked when an action is invoked for a menu item or button.

With update UI events, you define an event handler to look at the state of the application and change UI elements accordingly. wxWindows will call your member functions in idle time, so you don't have to worry where to call this code. In addition to being a clearer and more declarative method, it also means you don't have to worry whether you're updating a toolbar or menubar identifier. The same handler can update a menu item and toolbar button, if the identifier is the same.

Instead of directly manipulating the menu or button, you call functions in the event object, such as wxUpdateUIEvent::Check. wxWindows will determine whether such a call has been made, and which UI element to update.

These events will work for popup menus as well as menubars. Just before a menu is popped up, wxMenu::UpdateUI is called to process any UI events for the window that owns the menu.

See also

Event handling overview

Members

wxUpdateUIEvent::wxUpdateUIEvent
wxUpdateUIEvent::m_checked
wxUpdateUIEvent::m_enabled
wxUpdateUIEvent::m_setChecked
wxUpdateUIEvent::m_setEnabled
wxUpdateUIEvent::m_setText
wxUpdateUIEvent::m_text
wxUpdateUIEvent::Check
wxUpdateUIEvent::Enable
wxUpdateUIEvent::GetChecked
wxUpdateUIEvent::GetEnabled
wxUpdateUIEvent::GetSetChecked
wxUpdateUIEvent::GetSetEnabled
wxUpdateUIEvent::GetSetText
wxUpdateUIEvent::GetText
wxUpdateUIEvent::SetText


wxUpdateUIEvent::wxUpdateUIEvent

wxUpdateUIEvent(wxWindowID commandId = 0)

Constructor.


wxUpdateUIEvent::m_checked

bool m_checked

TRUE if the element should be checked, FALSE otherwise.


wxUpdateUIEvent::m_enabled

bool m_checked

TRUE if the element should be enabled, FALSE otherwise.


wxUpdateUIEvent::m_setChecked

bool m_setChecked

TRUE if the application has set the m_checked member.


wxUpdateUIEvent::m_setEnabled

bool m_setEnabled

TRUE if the application has set the m_enabled member.


wxUpdateUIEvent::m_setText

bool m_setText

TRUE if the application has set the m_text member.


wxUpdateUIEvent::m_text

wxString m_text

Holds the text with which the the application wishes to update the UI element.


wxUpdateUIEvent::Check

void Check(bool check)

Check or uncheck the UI element.


wxUpdateUIEvent::Enable

void Enable(bool enable)

Enable or disable the UI element.


wxUpdateUIEvent::GetChecked

bool GetChecked() const

Returns TRUE if the UI element should be checked.


wxUpdateUIEvent::GetEnabled

bool GetEnabled() const

Returns TRUE if the UI element should be enabled.


wxUpdateUIEvent::GetSetChecked

bool GetSetChecked() const

Returns TRUE if the application has called SetChecked. For wxWindows internal use only.


wxUpdateUIEvent::GetSetEnabled

bool GetSetEnabled() const

Returns TRUE if the application has called SetEnabled. For wxWindows internal use only.


wxUpdateUIEvent::GetSetText

bool GetSetText() const

Returns TRUE if the application has called SetText. For wxWindows internal use only.


wxUpdateUIEvent::GetText

wxString GetText() const

Returns the text that should be set for the UI element.


wxUpdateUIEvent::SetText

void SetText(const wxString& text)

Sets the text for this UI element.