Disable alias controls when no alias is selected.

Fixes: lp:1821698
* https://bugs.launchpad.net/kicad/+bug/1821698
This commit is contained in:
Jeff Young 2019-03-28 23:08:37 +00:00
parent 712bdc9d8d
commit b57e9492b1
1 changed files with 10 additions and 4 deletions

View File

@ -223,12 +223,10 @@ bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataToWindow()
} }
if( m_aliasListBox->GetCount() ) if( m_aliasListBox->GetCount() )
{
m_aliasListBox->SetSelection( 0 ); m_aliasListBox->SetSelection( 0 );
wxCommandEvent dummy; wxCommandEvent dummy;
OnSelectAlias( dummy ); OnSelectAlias( dummy );
}
adjustAliasGridColumns( m_aliasGrid->GetClientRect().GetWidth() - 4 ); adjustAliasGridColumns( m_aliasGrid->GetClientRect().GetWidth() - 4 );
@ -625,21 +623,29 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnSelectAlias( wxCommandEvent& event )
m_aliasGrid->SetCellValue( VALUE, FDC_VALUE, alias->GetName() ); m_aliasGrid->SetCellValue( VALUE, FDC_VALUE, alias->GetName() );
m_aliasGrid->SetCellValue( DATASHEET, FDC_VALUE, alias->GetDocFileName() ); m_aliasGrid->SetCellValue( DATASHEET, FDC_VALUE, alias->GetDocFileName() );
m_aliasGrid->Enable( true );
// Use ChangeValue() so we don't generate events // Use ChangeValue() so we don't generate events
m_AliasNameCtrl->ChangeValue( alias->GetName() ); m_AliasNameCtrl->ChangeValue( alias->GetName() );
m_AliasNameCtrl->Enable( true );
m_AliasDescCtrl->ChangeValue( alias->GetDescription() ); m_AliasDescCtrl->ChangeValue( alias->GetDescription() );
m_AliasDescCtrl->Enable( true );
m_AliasKeywordsCtrl->ChangeValue( alias->GetKeyWords() ); m_AliasKeywordsCtrl->ChangeValue( alias->GetKeyWords() );
m_AliasKeywordsCtrl->Enable( true );
} }
else else
{ {
m_aliasGrid->SetCellValue( VALUE, FDC_VALUE, wxEmptyString ); m_aliasGrid->SetCellValue( VALUE, FDC_VALUE, wxEmptyString );
m_aliasGrid->SetCellValue( DATASHEET, FDC_VALUE, wxEmptyString ); m_aliasGrid->SetCellValue( DATASHEET, FDC_VALUE, wxEmptyString );
m_aliasGrid->Enable( false );
// Use ChangeValue() so we don't generate events // Use ChangeValue() so we don't generate events
m_AliasNameCtrl->ChangeValue( wxEmptyString ); m_AliasNameCtrl->ChangeValue( wxEmptyString );
m_AliasNameCtrl->Enable( false );
m_AliasDescCtrl->ChangeValue( wxEmptyString ); m_AliasDescCtrl->ChangeValue( wxEmptyString );
m_AliasDescCtrl->Enable( false );
m_AliasKeywordsCtrl->ChangeValue( wxEmptyString ); m_AliasKeywordsCtrl->ChangeValue( wxEmptyString );
m_AliasKeywordsCtrl->Enable( false );
} }
m_currentAlias = newIdx; m_currentAlias = newIdx;