revert togglable tools to previous state if the change was vetoed by OnLeftClick()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32874 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -963,8 +963,8 @@ bool wxToolBar::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD id)
|
|||||||
LRESULT state = ::SendMessage(GetHwnd(), TB_GETSTATE, id, 0);
|
LRESULT state = ::SendMessage(GetHwnd(), TB_GETSTATE, id, 0);
|
||||||
toggled = (state & TBSTATE_CHECKED) != 0;
|
toggled = (state & TBSTATE_CHECKED) != 0;
|
||||||
|
|
||||||
// ignore the event when a radio button is released, as this doesn't seem to
|
// ignore the event when a radio button is released, as this doesn't
|
||||||
// happen at all, and is handled otherwise
|
// seem to happen at all, and is handled otherwise
|
||||||
if ( tool->GetKind() == wxITEM_RADIO && !toggled )
|
if ( tool->GetKind() == wxITEM_RADIO && !toggled )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -979,7 +979,7 @@ bool wxToolBar::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD id)
|
|||||||
// revert back
|
// revert back
|
||||||
tool->Toggle(!toggled);
|
tool->Toggle(!toggled);
|
||||||
|
|
||||||
::SendMessage(GetHwnd(), TB_CHECKBUTTON, id, MAKELONG(toggled, 0));
|
::SendMessage(GetHwnd(), TB_CHECKBUTTON, id, MAKELONG(!toggled, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user