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