1 \section{\class{wxButton
}}\label{wxbutton
}
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.
8 \wxheading{Derived from
}
10 \helpref{wxControl
}{wxcontrol
}\\
11 \helpref{wxWindow
}{wxwindow
}\\
12 \helpref{wxEvtHandler
}{wxevthandler
}\\
13 \helpref{wxObject
}{wxobject
}
15 \wxheading{Include files
}
19 \wxheading{Window styles
}
21 There are no special styles for wxButton.
23 See also
\helpref{window styles overview
}{windowstyles
}.
25 \wxheading{Event handling
}
28 \begin{twocollist
}\itemsep=
0pt
29 \twocolitem{{\bf EVT
\_BUTTON(id, func)
}}{Process a wxEVT
\_COMMAND\_BUTTON\_CLICKED event,
30 when the button is clicked.
}
35 \helpref{wxBitmapButton
}{wxbitmapbutton
}
37 \latexignore{\rtfignore{\wxheading{Members
}}}
39 \membersection{wxButton::wxButton
}\label{wxbuttonconstr
}
41 \func{}{wxButton
}{\void}
45 \func{}{wxButton
}{\param{wxWindow*
}{parent
},
\param{wxWindowID
}{ id
},
\param{const wxString\&
}{label
},
\rtfsp
46 \param{const wxPoint\&
}{pos
},
\param{const wxSize\&
}{size = wxDefaultSize
},
\rtfsp
47 \param{long
}{ style =
0},
\param{const wxValidator\&
}{validator
},
\param{const wxString\&
}{name = ``button"
}}
49 Constructor, creating and showing a button.
51 \wxheading{Parameters
}
53 \docparam{parent
}{Parent window. Must not be NULL.
}
55 \docparam{id
}{Button identifier. A value of -
1 indicates a default value.
}
57 \docparam{label
}{Text to be displayed on the button.
}
59 \docparam{pos
}{Button position.
}
61 \docparam{size
}{Button size. If the default size (-
1, -
1) is specified then the button is sized
62 appropriately for the text.
}
64 \docparam{style
}{Window style. See
\helpref{wxButton
}{wxbutton
}.
}
66 \docparam{validator
}{Window validator.
}
68 \docparam{name
}{Window name.
}
72 \helpref{wxButton::Create
}{wxbuttoncreate
},
\helpref{wxValidator
}{wxvalidator
}
74 \membersection{wxButton::
\destruct{wxButton
}}
76 \func{}{\destruct{wxButton
}}{\void}
78 Destructor, destroying the button.
80 \membersection{wxButton::Create
}\label{wxbuttoncreate
}
82 \func{bool
}{Create
}{\param{wxWindow*
}{parent
},
\param{wxWindowID
}{ id
},
\param{const wxString\&
}{label
},
\rtfsp
83 \param{const wxPoint\&
}{pos
},
\param{const wxSize\&
}{size = wxDefaultSize
},
\rtfsp
84 \param{long
}{ style =
0},
\param{const wxValidator\&
}{validator
},
\param{const wxString\&
}{name = ``button"
}}
86 Button creation function for two-step creation. For more details, see
\helpref{wxButton::wxButton
}{wxbuttonconstr
}.
88 \membersection{wxButton::GetLabel
}\label{wxbuttongetlabel
}
90 \constfunc{wxString
}{GetLabel
}{\void}
92 Returns the string label for the button.
94 \wxheading{Return value
}
100 \helpref{wxButton::SetLabel
}{wxbuttonsetlabel
}
102 \membersection{wxButton::GetDefaultSize
}\label{wxbuttongetdefaultsize
}
104 \func{wxSize
}{GetDefaultSize
}{\void}
106 Returns the default size for the buttons. It is advised to make all the dialog
107 buttons of the same size and this function allows to retrieve the (platform and
108 current font dependent size) which should be the best suited for this.
110 \membersection{wxButton::SetDefault
}\label{wxbuttonsetdefault
}
112 \func{void
}{SetDefault
}{\void}
114 This sets the button to be the default item for the panel or dialog
119 Under Windows, only dialog box buttons respond to this function. As
120 normal under Windows and Motif, pressing return causes the default button to
121 be depressed when the return key is pressed. See also
\helpref{wxWindow::SetFocus
}{wxwindowsetfocus
}\rtfsp
122 which sets the keyboard focus for windows and text panel items,
\rtfsp
123 and
\helpref{wxPanel::SetDefaultItem
}{wxpanelsetdefaultitem
}.
125 Note that under Motif, calling this function immediately after
126 creation of a button and before the creation of other buttons
127 will cause misalignment of the row of buttons, since default
128 buttons are larger. To get around this, call
{\it SetDefault
}\rtfsp
129 after you have created a row of buttons: wxWindows will
130 then set the size of all buttons currently on the panel to
133 \membersection{wxButton::SetLabel
}\label{wxbuttonsetlabel
}
135 \func{void
}{SetLabel
}{\param{const wxString\&
}{label
}}
137 Sets the string label for the button.
139 \wxheading{Parameters
}
141 \docparam{label
}{The label to set.
}
145 \helpref{wxButton::GetLabel
}{wxbuttongetlabel
}