]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/button.tex
more wxConfig and xwLog docs (sorry for the delay)
[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
15\wxheading{Window styles}
16
17There are no special styles for wxButton.
18
19See also \helpref{window styles overview}{windowstyles}.
20
5de76427
JS
21\wxheading{Event handling}
22
23\twocolwidtha{7cm}%
24\begin{twocollist}\itemsep=0pt
25\twocolitem{{\bf EVT\_BUTTON(id, func)}}{Process a wxEVT\_COMMAND\_BUTTON\_CLICKED event,
26when the button is clicked.}
27\end{twocollist}
28
a660d684
KB
29\wxheading{See also}
30
31\helpref{wxBitmapButton}{wxbitmapbutton}
32
33\latexignore{\rtfignore{\wxheading{Members}}}
34
35\membersection{wxButton::wxButton}\label{wxbuttonconstr}
36
37\func{}{wxButton}{\void}
38
39Default constructor.
40
eaaa6a06 41\func{}{wxButton}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id}, \param{const wxString\& }{label},\rtfsp
a660d684 42\param{const wxPoint\& }{pos}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
eaaa6a06 43\param{long}{ style = 0}, \param{const wxValidator\& }{validator}, \param{const wxString\& }{name = ``button"}}
a660d684
KB
44
45Constructor, creating and showing a button.
46
47\wxheading{Parameters}
48
49\docparam{parent}{Parent window. Must not be NULL.}
50
51\docparam{id}{Button identifier. A value of -1 indicates a default value.}
52
53\docparam{label}{Text to be displayed on the button.}
54
55\docparam{pos}{Button position.}
56
57\docparam{size}{Button size. If the default size (-1, -1) is specified then the button is sized
58appropriately for the text.}
59
60\docparam{style}{Window style. See \helpref{wxButton}{wxbutton}.}
61
62\docparam{validator}{Window validator.}
63
64\docparam{name}{Window name.}
65
66\wxheading{See also}
67
68\helpref{wxButton::Create}{wxbuttoncreate}, \helpref{wxValidator}{wxvalidator}
69
70\membersection{wxButton::\destruct{wxButton}}
71
72\func{}{\destruct{wxButton}}{\void}
73
74Destructor, destroying the button.
75
76\membersection{wxButton::Create}\label{wxbuttoncreate}
77
eaaa6a06 78\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id}, \param{const wxString\& }{label},\rtfsp
a660d684 79\param{const wxPoint\& }{pos}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
eaaa6a06 80\param{long}{ style = 0}, \param{const wxValidator\& }{validator}, \param{const wxString\& }{name = ``button"}}
a660d684
KB
81
82Button creation function for two-step creation. For more details, see \helpref{wxButton::wxButton}{wxbuttonconstr}.
83
84\membersection{wxButton::GetLabel}\label{wxbuttongetlabel}
85
86\constfunc{wxString}{GetLabel}{\void}
87
88Returns the string label for the button.
89
90\wxheading{Return value}
91
92The button's label.
93
94\wxheading{See also}
95
96\helpref{wxButton::SetLabel}{wxbuttonsetlabel}
97
98\membersection{wxButton::SetDefault}\label{wxbuttonsetdefault}
99
100\func{void}{SetDefault}{\void}
101
102This sets the button to be the default item for the panel or dialog
103box.
104
105\wxheading{Remarks}
106
107Under Windows, only dialog box buttons respond to this function. As
108normal under Windows and Motif, pressing return causes the default button to
109be depressed when the return key is pressed. See also \helpref{wxWindow::SetFocus}{wxwindowsetfocus}\rtfsp
f7bd2698 110which sets the keyboard focus for windows and text panel items,\rtfsp
a660d684
KB
111and \helpref{wxWindow::GetDefaultItem}{wxwindowgetdefaultitem}.
112
113Note that under Motif, calling this function immediately after
114creation of a button and before the creation of other buttons
115will cause misalignment of the row of buttons, since default
116buttons are larger. To get around this, call {\it SetDefault}\rtfsp
117after you have created a row of buttons: wxWindows will
118then set the size of all buttons currently on the panel to
119the same size.
120
121\membersection{wxButton::SetLabel}\label{wxbuttonsetlabel}
122
123\func{void}{SetLabel}{\param{const wxString\& }{label}}
124
125Sets the string label for the button.
126
127\wxheading{Parameters}
128
129\docparam{label}{The label to set.}
130
131\wxheading{See also}
132
133\helpref{wxButton::GetLabel}{wxbuttongetlabel}
134