]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/button.tex
Various; wxRadioButton::GetValue corrected
[wxWidgets.git] / docs / latex / wx / button.tex
1 \section{\class{wxButton}}\label{wxbutton}
2
3 A button is a control that contains a text string,
4 and 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
6 almost 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
17 There are no special styles for wxButton.
18
19 See also \helpref{window styles overview}{windowstyles}.
20
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,
26 when the button is clicked.}
27 \end{twocollist}
28
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
39 Default constructor.
40
41 \func{}{wxButton}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id}, \param{const wxString\& }{label},\rtfsp
42 \param{const wxPoint\& }{pos}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
43 \param{long}{ style = 0}, \param{const wxValidator\& }{validator}, \param{const wxString\& }{name = ``button"}}
44
45 Constructor, 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
58 appropriately 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
74 Destructor, destroying the button.
75
76 \membersection{wxButton::Create}\label{wxbuttoncreate}
77
78 \func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id}, \param{const wxString\& }{label},\rtfsp
79 \param{const wxPoint\& }{pos}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
80 \param{long}{ style = 0}, \param{const wxValidator\& }{validator}, \param{const wxString\& }{name = ``button"}}
81
82 Button 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
88 Returns the string label for the button.
89
90 \wxheading{Return value}
91
92 The 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
102 This sets the button to be the default item for the panel or dialog
103 box.
104
105 \wxheading{Remarks}
106
107 Under Windows, only dialog box buttons respond to this function. As
108 normal under Windows and Motif, pressing return causes the default button to
109 be depressed when the return key is pressed. See also \helpref{wxWindow::SetFocus}{wxwindowsetfocus}\rtfsp
110 which sets the keyboard focus for windows and text panel items,\rtfsp
111 and \helpref{wxWindow::GetDefaultItem}{wxwindowgetdefaultitem}.
112
113 Note that under Motif, calling this function immediately after
114 creation of a button and before the creation of other buttons
115 will cause misalignment of the row of buttons, since default
116 buttons are larger. To get around this, call {\it SetDefault}\rtfsp
117 after you have created a row of buttons: wxWindows will
118 then set the size of all buttons currently on the panel to
119 the same size.
120
121 \membersection{wxButton::SetLabel}\label{wxbuttonsetlabel}
122
123 \func{void}{SetLabel}{\param{const wxString\& }{label}}
124
125 Sets 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