X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c66c8042ad988f4b848fd8a967c1c1c5bc37610f..11c278c43c35e3bb40b2779673238752db31087a:/samples/toolbar/toolbar.cpp diff --git a/samples/toolbar/toolbar.cpp b/samples/toolbar/toolbar.cpp index 53b7e27c59..734a3d39df 100644 --- a/samples/toolbar/toolbar.cpp +++ b/samples/toolbar/toolbar.cpp @@ -508,7 +508,8 @@ void MyFrame::PopulateToolbar(wxToolBarBase* toolBar) // the changes 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 = 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 }