Patch #1003174: Fixes crash when toolbar has a disabled control

from Ian Brown.

  If you put a control (e.g. a wxChoice) on a toolbar and then
later disable that control, you will get a crash. This is because
the toolbar code always calls disable on the button widget for a
toolbartool. When the tool is a control, there is no button, and
you should call disable on the control instead.
This small patch implements this logic.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28940 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Mattia Barbon
2004-08-28 19:10:31 +00:00
parent b3370ae5d8
commit 6707bb9406

View File

@@ -592,8 +592,12 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
void wxToolBar::DoEnableTool(wxToolBarToolBase *toolBase, bool enable)
{
wxToolBarTool *tool = (wxToolBarTool *)toolBase;
XtSetSensitive(tool->GetButtonWidget(), (Boolean) enable);
if (tool->GetButtonWidget()){
XtSetSensitive(tool->GetButtonWidget(), (Boolean) enable);
} else if (wxTOOL_STYLE_CONTROL == tool->GetStyle()){
// Controls (such as wxChoice) do not have button widgets
tool->GetControl()->Enable(enable);
}
}
void wxToolBar::DoToggleTool(wxToolBarToolBase *toolBase, bool toggle)