contents up previous next

wxtogglebutton

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.

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 a toggle button click event.

see also

wxcheckbox, wxbutton

members

wxtogglebutton::wxtogglebutton
wxtogglebutton::~wxtogglebutton
wxtogglebutton::create
wxtogglebutton::getvalue
wxtogglebutton::setvalue


wxtogglebutton::wxtogglebutton

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::~wxtogglebutton

~wxtogglebutton()

destructor, destroying the toggle button.


wxtogglebutton::create

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.


wxtogglebutton::getvalue

bool getvalue() const

gets the state of the toggle button.

return value

returns true if it is pressed, false otherwise.


wxtogglebutton::setvalue

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