]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/button.tex
GTK
[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{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
31 Default 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
37 Constructor, 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
50 appropriately 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
66 Destructor, 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
74 Button 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
80 Returns the string label for the button.
81
82 \wxheading{Return value}
83
84 The 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
94 This sets the button to be the default item for the panel or dialog
95 box.
96
97 \wxheading{Remarks}
98
99 Under Windows, only dialog box buttons respond to this function. As
100 normal under Windows and Motif, pressing return causes the default button to
101 be depressed when the return key is pressed. See also \helpref{wxWindow::SetFocus}{wxwindowsetfocus}\rtfsp
102 which sets the keyboard focus for windows and text panel items, \helpref{wxWindow::OnDefaultAction}{wxwindowondefaultaction}\rtfsp
103 and \helpref{wxWindow::GetDefaultItem}{wxwindowgetdefaultitem}.
104
105 Note that under Motif, calling this function immediately after
106 creation of a button and before the creation of other buttons
107 will cause misalignment of the row of buttons, since default
108 buttons are larger. To get around this, call {\it SetDefault}\rtfsp
109 after you have created a row of buttons: wxWindows will
110 then set the size of all buttons currently on the panel to
111 the same size.
112
113 \membersection{wxButton::SetLabel}\label{wxbuttonsetlabel}
114
115 \func{void}{SetLabel}{\param{const wxString\& }{label}}
116
117 Sets 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