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
|
<HTML>
<head><title>wxButton</title></head>
<BODY BGCOLOR=#FFFFFF>
<A NAME="wxbutton"></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="wx30.htm#wxbusycursor"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx32.htm#wxbitmap"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>
<H2>wxButton</H2>
<P>
A button is a control that contains a text string,
and is one of the commonest elements of a GUI. It may be placed on a
<A HREF="wx71.htm#wxdialog">dialog box</A> or <A HREF="wx166.htm#wxpanel">panel</A>, or indeed
almost any other window.<P>
<B><FONT COLOR="#FF0000">Derived from</FONT></B><P>
<A HREF="wx56.htm#wxcontrol">wxControl</A><BR>
<A HREF="wx260.htm#wxwindow">wxWindow</A><BR>
<A HREF="wx85.htm#wxevthandler">wxEvtHandler</A><BR>
<A HREF="wx158.htm#wxobject">wxObject</A><P>
<B><FONT COLOR="#FF0000">Include files</FONT></B><P>
<wx/button.h><P>
<B><FONT COLOR="#FF0000">Window styles</FONT></B><P>
There are no special styles for wxButton.<P>
See also <A HREF="wx305.htm#windowstyles">window styles overview</A>.<P>
<B><FONT COLOR="#FF0000">Event handling</FONT></B><P>
<TABLE>
<TR><TD VALIGN=TOP>
<B>EVT_BUTTON(id, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_BUTTON_CLICKED event,
when the button is clicked.
</TD></TR>
</TABLE>
<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx34.htm#wxbitmapbutton">wxBitmapButton</A><P>
<B><FONT COLOR="#FF0000">Members</FONT></B><P>
<A HREF="#wxbuttonconstr">wxButton::wxButton</A><BR>
<A HREF="#topic48">wxButton::~wxButton</A><BR>
<A HREF="#wxbuttoncreate">wxButton::Create</A><BR>
<A HREF="#wxbuttongetlabel">wxButton::GetLabel</A><BR>
<A HREF="#wxbuttonsetdefault">wxButton::SetDefault</A><BR>
<A HREF="#wxbuttonsetlabel">wxButton::SetLabel</A><BR>
<P>
<HR>
<A NAME="wxbuttonconstr"></A>
<H3>wxButton::wxButton</H3>
<P>
<B></B> <B>wxButton</B>()<P>
Default constructor.<P>
<B></B> <B>wxButton</B>(<B>wxWindow* </B><I>parent</I>, <B>wxWindowID</B><I> id</I>, <B>const wxString& </B><I>label</I>,
<B>const wxPoint& </B><I>pos</I>, <B>const wxSize& </B><I>size = wxDefaultSize</I>,
<B>long</B><I> style = 0</I>, <B>const wxValidator& </B><I>validator</I>, <B>const wxString& </B><I>name = "button"</I>)<P>
Constructor, creating and showing a button.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>parent</I><UL><UL>
Parent window. Must not be NULL.</UL></UL>
<P>
<I>id</I><UL><UL>
Button identifier. A value of -1 indicates a default value.</UL></UL>
<P>
<I>label</I><UL><UL>
Text to be displayed on the button.</UL></UL>
<P>
<I>pos</I><UL><UL>
Button position.</UL></UL>
<P>
<I>size</I><UL><UL>
Button size. If the default size (-1, -1) is specified then the button is sized
appropriately for the text.</UL></UL>
<P>
<I>style</I><UL><UL>
Window style. See <A HREF="wx31.htm#wxbutton">wxButton</A>.</UL></UL>
<P>
<I>validator</I><UL><UL>
Window validator.</UL></UL>
<P>
<I>name</I><UL><UL>
Window name.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx31.htm#wxbuttoncreate">wxButton::Create</A>, <A HREF="wx255.htm#wxvalidator">wxValidator</A><P>
<HR>
<A NAME="topic48"></A>
<H3>wxButton::~wxButton</H3>
<P>
<B></B> <B>~wxButton</B>()<P>
Destructor, destroying the button.<P>
<HR>
<A NAME="wxbuttoncreate"></A>
<H3>wxButton::Create</H3>
<P>
<B>bool</B> <B>Create</B>(<B>wxWindow* </B><I>parent</I>, <B>wxWindowID</B><I> id</I>, <B>const wxString& </B><I>label</I>,
<B>const wxPoint& </B><I>pos</I>, <B>const wxSize& </B><I>size = wxDefaultSize</I>,
<B>long</B><I> style = 0</I>, <B>const wxValidator& </B><I>validator</I>, <B>const wxString& </B><I>name = "button"</I>)<P>
Button creation function for two-step creation. For more details, see <A HREF="wx31.htm#wxbuttonconstr">wxButton::wxButton</A>.<P>
<HR>
<A NAME="wxbuttongetlabel"></A>
<H3>wxButton::GetLabel</H3>
<P>
<B>wxString</B> <B>GetLabel</B>() <B>const</B><P>
Returns the string label for the button.<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
The button's label.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx31.htm#wxbuttonsetlabel">wxButton::SetLabel</A><P>
<HR>
<A NAME="wxbuttonsetdefault"></A>
<H3>wxButton::SetDefault</H3>
<P>
<B>void</B> <B>SetDefault</B>()<P>
This sets the button to be the default item for the panel or dialog
box.<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
Under Windows, only dialog box buttons respond to this function. As
normal under Windows and Motif, pressing return causes the default button to
be depressed when the return key is pressed. See also <A HREF="wx260.htm#wxwindowsetfocus">wxWindow::SetFocus</A>
which sets the keyboard focus for windows and text panel items,
and <A HREF="wx260.htm#wxwindowgetdefaultitem">wxWindow::GetDefaultItem</A>.<P>
Note that under Motif, calling this function immediately after
creation of a button and before the creation of other buttons
will cause misalignment of the row of buttons, since default
buttons are larger. To get around this, call <I>SetDefault</I>
after you have created a row of buttons: wxWindows will
then set the size of all buttons currently on the panel to
the same size.<P>
<HR>
<A NAME="wxbuttonsetlabel"></A>
<H3>wxButton::SetLabel</H3>
<P>
<B>void</B> <B>SetLabel</B>(<B>const wxString& </B><I>label</I>)<P>
Sets the string label for the button.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>label</I><UL><UL>
The label to set.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx31.htm#wxbuttongetlabel">wxButton::GetLabel</A><P>
</BODY></HTML>
|