A button is a control that contains a text string, and is one of the commonest elements of a GUI. It may be placed on a dialog box or panel, or indeed almost any other window.
Derived from
wxControl
wxWindow
wxEvtHandler
wxObject
Include files
<wx/button.h>
Window styles
There are no special styles for wxButton.
See also window styles overview.
Event handling
EVT_BUTTON(id, func) | Process a wxEVT_COMMAND_BUTTON_CLICKED event, when the button is clicked. |
See also
Members
wxButton::wxButton
wxButton::~wxButton
wxButton::Create
wxButton::GetLabel
wxButton::SetDefault
wxButton::SetLabel
wxButton()
Default constructor.
wxButton(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator, const wxString& name = "button")
Constructor, creating and showing a button.
Parameters
parent
id
label
pos
size
style
validator
name
See also
~wxButton()
Destructor, destroying the button.
bool Create(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator, const wxString& name = "button")
Button creation function for two-step creation. For more details, see wxButton::wxButton.
wxString GetLabel() const
Returns the string label for the button.
Return value
The button's label.
See also
void SetDefault()
This sets the button to be the default item for the panel or dialog box.
Remarks
Under Windows, only dialog box buttons respond to this function. As normal under Windows and Motif, pressing return causes the default button to be depressed when the return key is pressed. See also wxWindow::SetFocus which sets the keyboard focus for windows and text panel items, and wxWindow::GetDefaultItem.
Note that under Motif, calling this function immediately after creation of a button and before the creation of other buttons will cause misalignment of the row of buttons, since default buttons are larger. To get around this, call SetDefault after you have created a row of buttons: wxWindows will then set the size of all buttons currently on the panel to the same size.
void SetLabel(const wxString& label)
Sets the string label for the button.
Parameters
label
See also