Remove HasFocus() checks (which don't work on all platforms) in favour of row highlighting which is visible without focus.

Fixes: lp:1788873
* https://bugs.launchpad.net/kicad/+bug/1788873
This commit is contained in:
Jeff Young 2018-08-25 15:29:00 +01:00
parent f9aaa01329
commit 21eea1f567
3 changed files with 18 additions and 16 deletions

View File

@ -374,13 +374,9 @@ void DIALOG_CONFIGURE_PATHS::OnRemoveEnvVar( wxCommandEvent& event )
{
int curRow = m_EnvVars->GetGridCursorRow();
if( !m_EnvVars->HasFocus() || curRow < 0 )
{
m_EnvVars->SetFocus();
if( curRow < 0 )
return;
}
if( IsEnvVarImmutable( m_EnvVars->GetCellValue( curRow, EV_NAME_COL ) ) )
else if( IsEnvVarImmutable( m_EnvVars->GetCellValue( curRow, EV_NAME_COL ) ) )
{
wxBell();
return;

View File

@ -61,6 +61,11 @@ public:
{
SetTitle( wxString::Format( _( "Options for Library \"%s\"" ), aNickname ) );
// Give a bit more room for combobox editors
m_grid->SetDefaultRowSize( m_grid->GetDefaultRowSize() + 4 );
m_grid->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
// add Cut, Copy, and Paste to wxGrid
m_grid->PushEventHandler( new GRID_TRICKS( m_grid ) );
@ -243,12 +248,6 @@ private:
if( !m_grid->CommitPendingChanges() )
return;
if( !m_grid->HasFocus() )
{
m_grid->SetFocus();
return;
}
int curRow = m_grid->GetGridCursorRow();
m_grid->DeleteRows( curRow );

View File

@ -73,6 +73,12 @@ PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, PCB_EDIT_
m_netclassGrid->SetDefaultRowSize( m_netclassGrid->GetDefaultRowSize() + 4 );
m_membershipGrid->SetDefaultRowSize( m_membershipGrid->GetDefaultRowSize() + 4 );
m_netclassGrid->PushEventHandler( new GRID_TRICKS( m_netclassGrid ) );
m_membershipGrid->PushEventHandler( new GRID_TRICKS( m_membershipGrid ) );
m_netclassGrid->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
m_membershipGrid->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
// Set up the net name column of the netclass membership grid to read-only
wxGridCellAttr* attr = new wxGridCellAttr;
attr->SetReadOnly( true );
@ -92,6 +98,10 @@ PANEL_SETUP_NETCLASSES::~PANEL_SETUP_NETCLASSES()
{
delete [] m_originalColWidths;
// Delete the GRID_TRICKS.
m_netclassGrid->PopEventHandler( true );
m_membershipGrid->PopEventHandler( true );
m_netclassGrid->Disconnect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( PANEL_SETUP_NETCLASSES::OnNetclassGridCellChanging ), NULL, this );
}
@ -327,11 +337,8 @@ void PANEL_SETUP_NETCLASSES::OnRemoveNetclassClick( wxCommandEvent& event )
int curRow = m_netclassGrid->GetGridCursorRow();
if( !m_netclassGrid->HasFocus() || curRow < 0 )
{
m_netclassGrid->SetFocus();
if( curRow < 0 )
return;
}
else if( curRow == 0 )
{
DisplayErrorMessage( this, _( "The default net class is required." ) );