wxToggleButton is a button that stays pressed when clicked by the user. In other words, it is similar to wxCheckBox in functionality but looks like a wxButton.
You can see wxToggleButton in action in the sixth page of the controls sample.
NB: This class is only available under wxMSW, wxGTK and wxMotif currently.
Derived from
wxControl
wxWindow
wxEvtHandler
wxObject
Include files
<wx/tglbtn.h>
Window styles
There are no special styles for wxToggleButton.
See also window styles overview.
Event handling
EVT_TOGGLEBUTTON(id, func) | Handles button click event. |
See also
Members
wxToggleButton::wxToggleButton
wxToggleButton::~wxToggleButton
wxToggleButton::Create
wxToggleButton::GetValue
wxToggleButton::SetValue
wxToggleButton()
Default constructor.
wxToggleButton(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& val, const wxString& name = "checkBox")
Constructor, creating and showing a toggle button.
Parameters
parent
id
label
pos
size
style
validator
name
See also
wxToggleButton::Create, wxValidator
~wxToggleButton()
Destructor, destroying the toggle button.
bool Create(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& val, const wxString& name = "checkBox")
Creates the toggle button for two-step construction. See wxToggleButton::wxToggleButton for details.
bool GetValue() const
Gets the state of the toggle button.
Return value
Returns true if it is pressed, false otherwise.
void SetValue(const bool state)
Sets the toggle button to the given state. This does not cause a EVT_TOGGLEBUTTON event to be emitted.
Parameters
state