]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/button.tex
Applied patch for multiple file selection, documented.
[wxWidgets.git] / docs / latex / wx / button.tex
... / ...
CommitLineData
1\section{\class{wxButton}}\label{wxbutton}
2
3A button is a control that contains a text string,
4and is one of the commonest elements of a GUI. It may be placed on a
5\rtfsp\helpref{dialog box}{wxdialog} or \helpref{panel}{wxpanel}, or indeed
6almost any other window.
7
8\wxheading{Derived from}
9
10\helpref{wxControl}{wxcontrol}\\
11\helpref{wxWindow}{wxwindow}\\
12\helpref{wxEvtHandler}{wxevthandler}\\
13\helpref{wxObject}{wxobject}
14
15\wxheading{Include files}
16
17<wx/button.h>
18
19\wxheading{Window styles}
20
21There are no special styles for wxButton.
22
23See also \helpref{window styles overview}{windowstyles}.
24
25\wxheading{Event handling}
26
27\twocolwidtha{7cm}%
28\begin{twocollist}\itemsep=0pt
29\twocolitem{{\bf EVT\_BUTTON(id, func)}}{Process a wxEVT\_COMMAND\_BUTTON\_CLICKED event,
30when the button is clicked.}
31\end{twocollist}
32
33\wxheading{See also}
34
35\helpref{wxBitmapButton}{wxbitmapbutton}
36
37\latexignore{\rtfignore{\wxheading{Members}}}
38
39\membersection{wxButton::wxButton}\label{wxbuttonconstr}
40
41\func{}{wxButton}{\void}
42
43Default constructor.
44
45\func{}{wxButton}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id}, \param{const wxString\& }{label},\rtfsp
46\param{const wxPoint\& }{pos}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
47\param{long}{ style = 0}, \param{const wxValidator\& }{validator}, \param{const wxString\& }{name = ``button"}}
48
49Constructor, creating and showing a button.
50
51\wxheading{Parameters}
52
53\docparam{parent}{Parent window. Must not be NULL.}
54
55\docparam{id}{Button identifier. A value of -1 indicates a default value.}
56
57\docparam{label}{Text to be displayed on the button.}
58
59\docparam{pos}{Button position.}
60
61\docparam{size}{Button size. If the default size (-1, -1) is specified then the button is sized
62appropriately for the text.}
63
64\docparam{style}{Window style. See \helpref{wxButton}{wxbutton}.}
65
66\docparam{validator}{Window validator.}
67
68\docparam{name}{Window name.}
69
70\wxheading{See also}
71
72\helpref{wxButton::Create}{wxbuttoncreate}, \helpref{wxValidator}{wxvalidator}
73
74\membersection{wxButton::\destruct{wxButton}}
75
76\func{}{\destruct{wxButton}}{\void}
77
78Destructor, destroying the button.
79
80\membersection{wxButton::Create}\label{wxbuttoncreate}
81
82\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id}, \param{const wxString\& }{label},\rtfsp
83\param{const wxPoint\& }{pos}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
84\param{long}{ style = 0}, \param{const wxValidator\& }{validator}, \param{const wxString\& }{name = ``button"}}
85
86Button creation function for two-step creation. For more details, see \helpref{wxButton::wxButton}{wxbuttonconstr}.
87
88\membersection{wxButton::GetLabel}\label{wxbuttongetlabel}
89
90\constfunc{wxString}{GetLabel}{\void}
91
92Returns the string label for the button.
93
94\wxheading{Return value}
95
96The button's label.
97
98\wxheading{See also}
99
100\helpref{wxButton::SetLabel}{wxbuttonsetlabel}
101
102\membersection{wxButton::GetDefaultSize}\label{wxbuttongetdefaultsize}
103
104\func{wxSize}{GetDefaultSize}{\void}
105
106Returns the default size for the buttons. It is advised to make all the dialog
107buttons of the same size and this function allows to retrieve the (platform and
108current font dependent size) which should be the best suited for this.
109
110\membersection{wxButton::SetDefault}\label{wxbuttonsetdefault}
111
112\func{void}{SetDefault}{\void}
113
114This sets the button to be the default item for the panel or dialog
115box.
116
117\wxheading{Remarks}
118
119Under Windows, only dialog box buttons respond to this function. As
120normal under Windows and Motif, pressing return causes the default button to
121be depressed when the return key is pressed. See also \helpref{wxWindow::SetFocus}{wxwindowsetfocus}\rtfsp
122which sets the keyboard focus for windows and text panel items,\rtfsp
123and \helpref{wxWindow::GetDefaultItem}{wxwindowgetdefaultitem}.
124
125Note that under Motif, calling this function immediately after
126creation of a button and before the creation of other buttons
127will cause misalignment of the row of buttons, since default
128buttons are larger. To get around this, call {\it SetDefault}\rtfsp
129after you have created a row of buttons: wxWindows will
130then set the size of all buttons currently on the panel to
131the same size.
132
133\membersection{wxButton::SetLabel}\label{wxbuttonsetlabel}
134
135\func{void}{SetLabel}{\param{const wxString\& }{label}}
136
137Sets the string label for the button.
138
139\wxheading{Parameters}
140
141\docparam{label}{The label to set.}
142
143\wxheading{See also}
144
145\helpref{wxButton::GetLabel}{wxbuttongetlabel}
146