wxToolBarTool *tool2 = (wxToolBarTool*)node->GetData();
if ( tool2->IsControl() )
{
+ wxControl * const control = tool2->GetControl();
+
int x;
- wxControl *control = tool2->GetControl();
control->GetPosition(&x, NULL);
control->Move(x - width, wxDefaultCoord);
- wxStaticText* staticText = tool2->GetStaticText();
- staticText->Move(x - width, wxDefaultCoord);
+ wxStaticText * const staticText = tool2->GetStaticText();
+ if ( staticText )
+ staticText->Move(x - width, wxDefaultCoord);
}
}
bool wxToolBar::HandleSize(WXWPARAM WXUNUSED(wParam), WXLPARAM lParam)
{
+ // wait until we have some tools
+ if ( !GetToolsCount() )
+ return false;
+
// calculate our minor dimension ourselves - we're confusing the standard
// logic (TB_AUTOSIZE) with our horizontal toolbars and other hacks
const RECT r = wxGetTBItemRect(GetHwnd(), 0);