ToggleButton Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
martin.martinec
In need of some credit
In need of some credit
Posts: 6
Joined: Sun May 24, 2020 1:56 pm

ToggleButton

Post by martin.martinec »

Hello,

Can anybody guide me on how to use the toggle button (wxToggleButton) for calling two different methods depending on the state of the button?
...
wxToggleButton* m_button_server;
...
EVT_TOGGLEBUTTON(wxID_BUTSERVER, NetClockFrame::OnServerStart)
EVT_TOGGLEBUTTON(wxID_BUTSERVER, NetClockFrame::OnServerStop)
...

m_button_server = new wxToggleButton(m_panel, wxID_BUTSERVER, _T("server [on/off]"), wxPoint(233, 30));

m_button_server->Bind(wxEVT_TOGGLEBUTTON, &NetClockFrame::OnServerStart, this);
m_button_server->Bind(wxEVT_TOGGLEBUTTON, &NetClockFrame::OnServerStop, this);

Regards,
MM
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: ToggleButton

Post by doublemax »

You can't. But you can use event.GetInt() inside the event handler to get the state of the toggle button.
Use the source, Luke!
Post Reply