DIALOG_LIB_FIELDS_TABLE & DIALOG_SYMBOL_FIELDS_TABLE: avoid empty m_viewControlsGrid.
The fix is more a workaround: if all columns of m_viewControlsGrid are removed by the right click menu and the grid is empty, there are no way to re-add a column. When happens, this workaround re-add a column when reopening the dialog to avoid a empty grid.
This commit is contained in:
@@ -318,6 +318,15 @@ DIALOG_LIB_FIELDS_TABLE::DIALOG_LIB_FIELDS_TABLE( SYMBOL_EDIT_FRAME* parent, DIA
|
||||
SYMBOL_EDITOR_SETTINGS::PANEL_LIB_FIELDS_TABLE& cfg = m_parent->libeditconfig()->m_LibFieldEditor;
|
||||
|
||||
m_viewControlsGrid->ShowHideColumns( cfg.view_controls_visible_columns );
|
||||
// Ensure at least one column is visible otherwise we cannot add columns
|
||||
// because there is no area to right click to get the menu managing the show/hide columns
|
||||
wxString visible_column = m_viewControlsGrid->GetShownColumnsAsString();;
|
||||
|
||||
if( visible_column.IsEmpty() )
|
||||
{
|
||||
visible_column = wxT( "0" );
|
||||
m_viewControlsGrid->ShowHideColumns( visible_column );
|
||||
}
|
||||
|
||||
CallAfter( [this, cfg]()
|
||||
{
|
||||
|
||||
@@ -336,14 +336,16 @@ DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE( SCH_EDIT_FRAME* parent,
|
||||
|
||||
m_nbPages->SetSelection( cfg.page );
|
||||
|
||||
//Hide/display m_viewControlsGrid column. Ensure at least one column is visible
|
||||
// otherwise we cannot add columns
|
||||
wxString visible_column = cfg.view_controls_visible_columns;
|
||||
m_viewControlsGrid->ShowHideColumns( cfg.view_controls_visible_columns );
|
||||
// Ensure at least one column is visible otherwise we cannot add columns
|
||||
// because there is no area to right click to get the menu managing the show/hide columns
|
||||
wxString visible_column = m_viewControlsGrid->GetShownColumnsAsString();;
|
||||
|
||||
if( visible_column.IsEmpty() )
|
||||
{
|
||||
visible_column = wxT( "0" );
|
||||
|
||||
m_viewControlsGrid->ShowHideColumns( visible_column );
|
||||
m_viewControlsGrid->ShowHideColumns( visible_column );
|
||||
}
|
||||
|
||||
CallAfter( [this, cfg]()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user