Don't hardcode the number of toolbar tools in the toolbar sample.
Use GetToolsCount() instead of the hardcoded 10 (which can be wrong if any tools were added or removed). See #13673. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69855 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
c66c8042ad
commit
09c0ebcf96
@ -508,7 +508,8 @@ void MyFrame::PopulateToolbar(wxToolBarBase* toolBar)
|
|||||||
// the changes
|
// the changes
|
||||||
toolBar->Realize();
|
toolBar->Realize();
|
||||||
|
|
||||||
toolBar->SetRows(!(toolBar->IsVertical()) ? m_rows : 10 / m_rows);
|
toolBar->SetRows(toolBar->IsVertical() ? toolBar->GetToolsCount() / m_rows
|
||||||
|
: m_rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -762,7 +763,9 @@ void MyFrame::OnToggleToolbarRows(wxCommandEvent& WXUNUSED(event))
|
|||||||
// m_rows may be only 1 or 2
|
// m_rows may be only 1 or 2
|
||||||
m_rows = 3 - m_rows;
|
m_rows = 3 - m_rows;
|
||||||
|
|
||||||
GetToolBar()->SetRows(!(GetToolBar()->IsVertical()) ? m_rows : 10 / m_rows);
|
wxToolBar* const toolBar = GetToolBar();
|
||||||
|
toolBar->SetRows(toolBar->IsVertical() ? toolBar->GetToolsCount() / m_rows
|
||||||
|
: m_rows);
|
||||||
|
|
||||||
//RecreateToolbar(); -- this is unneeded
|
//RecreateToolbar(); -- this is unneeded
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user