Fix disabling control tools in wxMSW wxToolBar
Tools containing controls should be enabled/disabled in a different way from the button tools in wxToolBar::DoEnableTool(). The control and its label (if any) need to be explicitly enabled/disabled for wxToolBarBase::EnableTool() to work properly. Closes #17346.
This commit is contained in:
committed by
Vadim Zeitlin
parent
fadda15db1
commit
68eae6ba5b
@@ -1597,12 +1597,24 @@ void wxToolBar::SetWindowStyleFlag(long style)
|
|||||||
|
|
||||||
void wxToolBar::DoEnableTool(wxToolBarToolBase *tool, bool enable)
|
void wxToolBar::DoEnableTool(wxToolBarToolBase *tool, bool enable)
|
||||||
{
|
{
|
||||||
::SendMessage(GetHwnd(), TB_ENABLEBUTTON,
|
if ( tool->IsButton() )
|
||||||
(WPARAM)tool->GetId(), (LPARAM)MAKELONG(enable, 0));
|
{
|
||||||
|
::SendMessage(GetHwnd(), TB_ENABLEBUTTON,
|
||||||
|
(WPARAM)tool->GetId(), (LPARAM)MAKELONG(enable, 0));
|
||||||
|
|
||||||
// Adjust displayed checked state -- it could have changed if the tool is
|
// Adjust displayed checked state -- it could have changed if the tool is
|
||||||
// disabled and has a custom "disabled state" bitmap.
|
// disabled and has a custom "disabled state" bitmap.
|
||||||
DoToggleTool(tool, tool->IsToggled());
|
DoToggleTool(tool, tool->IsToggled());
|
||||||
|
}
|
||||||
|
else if ( tool->IsControl() )
|
||||||
|
{
|
||||||
|
wxToolBarTool* tbTool = static_cast<wxToolBarTool*>(tool);
|
||||||
|
|
||||||
|
tbTool->GetControl()->Enable(enable);
|
||||||
|
wxStaticText* text = tbTool->GetStaticText();
|
||||||
|
if ( text )
|
||||||
|
text->Enable(enable);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToolBar::DoToggleTool(wxToolBarToolBase *tool,
|
void wxToolBar::DoToggleTool(wxToolBarToolBase *tool,
|
||||||
|
Reference in New Issue
Block a user