wxWidgets/docs/latex/wx/upduievt.tex

152 lines
4.7 KiB
TeX
Raw Normal View History

\section{\class{wxUpdateUIEvent}}\label{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.
\wxheading{Derived from}
\helpref{wxCommandEvent}{wxcommandevent}\\
\helpref{wxEvent}{wxevent}\\
\helpref{wxObject}{wxobject}
\wxheading{Include files}
<wx/event.h>
\wxheading{Event table macros}
To process an update event, use these event handler macros to direct input to member
functions that take a wxUpdateUIEvent argument.
\twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf EVT\_UPDATE\_UI(id, func)}}{Process a wxEVT\_UPDATE\_UI event for the command with the given id.}
\twocolitem{{\bf EVT\_UPDATE\_UI\_RANGE(id1, id2, func)}}{Process a wxEVT\_UPDATE\_UI event for any command with id included in the given range.}
\end{twocollist}%
\wxheading{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 \helpref{wxUpdateUIEvent::Check}{wxupdateuieventcheck}. 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, \helpref{wxMenu::UpdateUI}{wxmenuupdateui} is called to process any UI events for
the window that owns the menu.
\wxheading{See also}
\helpref{Event handling overview}{eventhandlingoverview}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxUpdateUIEvent::wxUpdateUIEvent}
\func{}{wxUpdateUIEvent}{\param{wxWindowID }{commandId = 0}}
Constructor.
\membersection{wxUpdateUIEvent::m\_checked}
\member{bool}{m\_checked}
TRUE if the element should be checked, FALSE otherwise.
\membersection{wxUpdateUIEvent::m\_enabled}
\member{bool}{m\_checked}
TRUE if the element should be enabled, FALSE otherwise.
\membersection{wxUpdateUIEvent::m\_setChecked}
\member{bool}{m\_setChecked}
TRUE if the application has set the {\bf m\_checked} member.
\membersection{wxUpdateUIEvent::m\_setEnabled}
\member{bool}{m\_setEnabled}
TRUE if the application has set the {\bf m\_enabled} member.
\membersection{wxUpdateUIEvent::m\_setText}
\member{bool}{m\_setText}
TRUE if the application has set the {\bf m\_text} member.
\membersection{wxUpdateUIEvent::m\_text}
\member{wxString}{m\_text}
Holds the text with which the the application wishes to
update the UI element.
\membersection{wxUpdateUIEvent::Check}\label{wxupdateuieventcheck}
\func{void}{Check}{\param{bool}{ check}}
Check or uncheck the UI element.
\membersection{wxUpdateUIEvent::Enable}\label{wxupdateuieventenable}
\func{void}{Enable}{\param{bool}{ enable}}
Enable or disable the UI element.
\membersection{wxUpdateUIEvent::GetChecked}\label{wxupdateuieventgetchecked}
\constfunc{bool}{GetChecked}{\void}
Returns TRUE if the UI element should be checked.
\membersection{wxUpdateUIEvent::GetEnabled}\label{wxupdateuieventgetenabled}
\constfunc{bool}{GetEnabled}{\void}
Returns TRUE if the UI element should be enabled.
\membersection{wxUpdateUIEvent::GetSetChecked}\label{wxupdateuieventgetsetchecked}
\constfunc{bool}{GetSetChecked}{\void}
Returns TRUE if the application has called {\bf SetChecked}. For wxWindows internal use only.
\membersection{wxUpdateUIEvent::GetSetEnabled}\label{wxupdateuieventgetsetenabled}
\constfunc{bool}{GetSetEnabled}{\void}
Returns TRUE if the application has called {\bf SetEnabled}. For wxWindows internal use only.
\membersection{wxUpdateUIEvent::GetSetText}\label{wxupdateuieventgetsettext}
\constfunc{bool}{GetSetText}{\void}
Returns TRUE if the application has called {\bf SetText}. For wxWindows internal use only.
\membersection{wxUpdateUIEvent::GetText}\label{wxupdateuieventgettext}
\constfunc{wxString}{GetText}{\void}
Returns the text that should be set for the UI element.
\membersection{wxUpdateUIEvent::SetText}\label{wxupdateuieventsettext}
\func{void}{SetText}{\param{const wxString\&}{ text}}
Sets the text for this UI element.