1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
|
<HTML>
<head><title>wxUpdateUIEvent</title></head>
<BODY BGCOLOR=#FFFFFF>
<A NAME="wxupdateuievent"></A><CENTER>
<A HREF="wx.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx22.htm#classref"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx252.htm#wxtreeevent"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx254.htm#wxurl"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>
<H2>wxUpdateUIEvent</H2>
<P>
This class is used for pseudo-events which are called by wxWindows
to give an application the chance to update various user interface elements.<P>
<B><FONT COLOR="#FF0000">Derived from</FONT></B><P>
<A HREF="wx84.htm#wxevent">wxEvent</A><BR>
<A HREF="wx158.htm#wxobject">wxObject</A><P>
<B><FONT COLOR="#FF0000">Include files</FONT></B><P>
<wx/event.h><P>
<B><FONT COLOR="#FF0000">Event table macros</FONT></B><P>
To process an update event, use these event handler macros to direct input to member
functions that take a wxUpdateUIEvent argument.<P>
<TABLE>
<TR><TD VALIGN=TOP>
<B>EVT_UPDATE_UI(id, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_UPDATE_UI event.
</TD></TR>
</TABLE>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
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.<P>
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.<P>
Instead of directly manipulating the menu or button, you call functions in the event
object, such as <A HREF="wx253.htm#wxupdateuieventcheck">wxUpdateUIEvent::Check</A>. wxWindows
will determine whether such a call has been made, and which UI element to update.<P>
These events will work for popup menus as well as menubars. Just before a menu is popped
up, <A HREF="wx140.htm#wxmenuupdateui">wxMenu::UpdateUI</A> is called to process any UI events for
the window that owns the menu.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P>
<B><FONT COLOR="#FF0000">Members</FONT></B><P>
<A HREF="#topic991">wxUpdateUIEvent::wxUpdateUIEvent</A><BR>
<A HREF="#topic992">wxUpdateUIEvent::m_checked</A><BR>
<A HREF="#topic993">wxUpdateUIEvent::m_enabled</A><BR>
<A HREF="#topic994">wxUpdateUIEvent::m_setChecked</A><BR>
<A HREF="#topic995">wxUpdateUIEvent::m_setEnabled</A><BR>
<A HREF="#topic996">wxUpdateUIEvent::m_setText</A><BR>
<A HREF="#topic997">wxUpdateUIEvent::m_text</A><BR>
<A HREF="#wxupdateuieventcheck">wxUpdateUIEvent::Check</A><BR>
<A HREF="#wxupdateuieventenable">wxUpdateUIEvent::Enable</A><BR>
<A HREF="#wxupdateuieventgetchecked">wxUpdateUIEvent::GetChecked</A><BR>
<A HREF="#wxupdateuieventgetenabled">wxUpdateUIEvent::GetEnabled</A><BR>
<A HREF="#wxupdateuieventgetsetchecked">wxUpdateUIEvent::GetSetChecked</A><BR>
<A HREF="#wxupdateuieventgetsetenabled">wxUpdateUIEvent::GetSetEnabled</A><BR>
<A HREF="#wxupdateuieventgetsettext">wxUpdateUIEvent::GetSetText</A><BR>
<A HREF="#wxupdateuieventgettext">wxUpdateUIEvent::GetText</A><BR>
<A HREF="#wxupdateuieventsettext">wxUpdateUIEvent::SetText</A><BR>
<P>
<HR>
<A NAME="topic991"></A>
<H3>wxUpdateUIEvent::wxUpdateUIEvent</H3>
<P>
<B></B> <B>wxUpdateUIEvent</B>(<B>wxWindowID </B><I>commandId = 0</I>)<P>
Constructor.<P>
<HR>
<A NAME="topic992"></A>
<H3>wxUpdateUIEvent::m_checked</H3>
<P>
bool m_checked<P>
TRUE if the element should be checked, FALSE otherwise.<P>
<HR>
<A NAME="topic993"></A>
<H3>wxUpdateUIEvent::m_enabled</H3>
<P>
bool m_checked<P>
TRUE if the element should be enabled, FALSE otherwise.<P>
<HR>
<A NAME="topic994"></A>
<H3>wxUpdateUIEvent::m_setChecked</H3>
<P>
bool m_setChecked<P>
TRUE if the application has set the <B>m_checked</B> member.<P>
<HR>
<A NAME="topic995"></A>
<H3>wxUpdateUIEvent::m_setEnabled</H3>
<P>
bool m_setEnabled<P>
TRUE if the application has set the <B>m_enabled</B> member.<P>
<HR>
<A NAME="topic996"></A>
<H3>wxUpdateUIEvent::m_setText</H3>
<P>
bool m_setText<P>
TRUE if the application has set the <B>m_text</B> member.<P>
<HR>
<A NAME="topic997"></A>
<H3>wxUpdateUIEvent::m_text</H3>
<P>
wxString m_text<P>
Holds the text with which the the application wishes to
update the UI element.<P>
<HR>
<A NAME="wxupdateuieventcheck"></A>
<H3>wxUpdateUIEvent::Check</H3>
<P>
<B>void</B> <B>Check</B>(<B>bool</B><I> check</I>)<P>
Check or uncheck the UI element.<P>
<HR>
<A NAME="wxupdateuieventenable"></A>
<H3>wxUpdateUIEvent::Enable</H3>
<P>
<B>void</B> <B>Enable</B>(<B>bool</B><I> enable</I>)<P>
Enable or disable the UI element.<P>
<HR>
<A NAME="wxupdateuieventgetchecked"></A>
<H3>wxUpdateUIEvent::GetChecked</H3>
<P>
<B>bool</B> <B>GetChecked</B>() <B>const</B><P>
Returns TRUE if the UI element should be checked.<P>
<HR>
<A NAME="wxupdateuieventgetenabled"></A>
<H3>wxUpdateUIEvent::GetEnabled</H3>
<P>
<B>bool</B> <B>GetEnabled</B>() <B>const</B><P>
Returns TRUE if the UI element should be enabled.<P>
<HR>
<A NAME="wxupdateuieventgetsetchecked"></A>
<H3>wxUpdateUIEvent::GetSetChecked</H3>
<P>
<B>bool</B> <B>GetSetChecked</B>() <B>const</B><P>
Returns TRUE if the application has called <B>SetChecked</B>. For wxWindows internal use only.<P>
<HR>
<A NAME="wxupdateuieventgetsetenabled"></A>
<H3>wxUpdateUIEvent::GetSetEnabled</H3>
<P>
<B>bool</B> <B>GetSetEnabled</B>() <B>const</B><P>
Returns TRUE if the application has called <B>SetEnabled</B>. For wxWindows internal use only.<P>
<HR>
<A NAME="wxupdateuieventgetsettext"></A>
<H3>wxUpdateUIEvent::GetSetText</H3>
<P>
<B>bool</B> <B>GetSetText</B>() <B>const</B><P>
Returns TRUE if the application has called <B>SetText</B>. For wxWindows internal use only.<P>
<HR>
<A NAME="wxupdateuieventgettext"></A>
<H3>wxUpdateUIEvent::GetText</H3>
<P>
<B>wxString</B> <B>GetText</B>() <B>const</B><P>
Returns the text that should be set for the UI element.<P>
<HR>
<A NAME="wxupdateuieventsettext"></A>
<H3>wxUpdateUIEvent::SetText</H3>
<P>
<B>void</B> <B>SetText</B>(<B>const wxString&</B><I> text</I>)<P>
Sets the text for this UI element.<P>
</BODY></HTML>
|