PANEL_FP_LIB_TABLE: fix incorrect size of the SPLIT_BUTTON.

This was due to use of a not yet calculated of a bitmap button.
At least on msw just after setting the bitmap of a bitmap button
the actual size is not yet calculated: it is calculated after calling Layout()
This commit is contained in:
jean-pierre charras 2020-06-08 10:19:31 +02:00
parent a9fa592f5f
commit f8967550a8
1 changed files with 9 additions and 7 deletions

View File

@ -446,16 +446,18 @@ PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent,
m_delete_button->SetBitmap( KiBitmap( trash_xpm ) );
m_move_up_button->SetBitmap( KiBitmap( small_up_xpm ) );
m_move_down_button->SetBitmap( KiBitmap( small_down_xpm ) );
wxSize buttonSize = m_append_button->GetSize();
m_browseButton->SetBitmap( KiBitmap( folder_xpm ) );
// We must set the size to match the other bitmaps manually
// For aesthetic reasons, we must set the size of m_browseButton to match
// the other bitmaps manually (for instance m_append_button)
Layout(); // Needed at least on MSW to compute the actual buttons sizes,
// after initializing their bitmaps
wxSize buttonSize = m_append_button->GetSize();
m_browseButton->SetWidthPadding( 4 );
m_browseButton->SetMinSize( buttonSize );
// Gives a selection to each grid, mainly for delete button. wxGrid's wake up with
// Gives a selection to each grid, mainly for delete button. wxGrid's wake up with
// a currentCell which is sometimes not highlighted.
if( m_global_grid->GetNumberRows() > 0 )
m_global_grid->SelectRow( 0 );
@ -463,8 +465,6 @@ PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent,
if( m_project_grid->GetNumberRows() > 0 )
m_project_grid->SelectRow( 0 );
wxSize textSize;
// Populate the browse library options
wxMenu* browseMenu = m_browseButton->GetSplitButtonMenu();
@ -476,6 +476,8 @@ PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent,
this, fileType.first );
}
Layout();
// This is the button only press for the browse button instead of the menu
m_browseButton->Bind( wxEVT_BUTTON, &PANEL_FP_LIB_TABLE::browseLibrariesHandler, this );
}