]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/button.tex
1. wxMSW seems to work (please test and send your bug reports!)
[wxWidgets.git] / docs / latex / wx / button.tex
CommitLineData
a660d684
KB
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
954b8ae6
JS
15\wxheading{Include files}
16
17<wx/button.h>
18
a660d684
KB
19\wxheading{Window styles}
20
21There are no special styles for wxButton.
22
23See also \helpref{window styles overview}{windowstyles}.
24
5de76427
JS
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
a660d684
KB
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
eaaa6a06 45\func{}{wxButton}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id}, \param{const wxString\& }{label},\rtfsp
a660d684 46\param{const wxPoint\& }{pos}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
eaaa6a06 47\param{long}{ style = 0}, \param{const wxValidator\& }{validator}, \param{const wxString\& }{name = ``button"}}
a660d684
KB
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
eaaa6a06 82\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id}, \param{const wxString\& }{label},\rtfsp
a660d684 83\param{const wxPoint\& }{pos}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
eaaa6a06 84\param{long}{ style = 0}, \param{const wxValidator\& }{validator}, \param{const wxString\& }{name = ``button"}}
a660d684
KB
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::SetDefault}\label{wxbuttonsetdefault}
103
104\func{void}{SetDefault}{\void}
105
106This sets the button to be the default item for the panel or dialog
107box.
108
109\wxheading{Remarks}
110
111Under Windows, only dialog box buttons respond to this function. As
112normal under Windows and Motif, pressing return causes the default button to
113be depressed when the return key is pressed. See also \helpref{wxWindow::SetFocus}{wxwindowsetfocus}\rtfsp
f7bd2698 114which sets the keyboard focus for windows and text panel items,\rtfsp
a660d684
KB
115and \helpref{wxWindow::GetDefaultItem}{wxwindowgetdefaultitem}.
116
117Note that under Motif, calling this function immediately after
118creation of a button and before the creation of other buttons
119will cause misalignment of the row of buttons, since default
120buttons are larger. To get around this, call {\it SetDefault}\rtfsp
121after you have created a row of buttons: wxWindows will
122then set the size of all buttons currently on the panel to
123the same size.
124
125\membersection{wxButton::SetLabel}\label{wxbuttonsetlabel}
126
127\func{void}{SetLabel}{\param{const wxString\& }{label}}
128
129Sets the string label for the button.
130
131\wxheading{Parameters}
132
133\docparam{label}{The label to set.}
134
135\wxheading{See also}
136
137\helpref{wxButton::GetLabel}{wxbuttongetlabel}
138