Dont' create new cell if editing one

Return key is used to change cell line. If cell was in edition, the edition is saved before changing line.

Before this change using return key in the last row, if edited, both saved the change and create new row.

After this change, it'll just save the just, and will need a second key press to create a new row.
This commit is contained in:
Lucas Dumont 2023-04-14 15:29:28 +12:00 committed by jean-pierre charras
parent 05185ec81a
commit 923f386f08
1 changed files with 6 additions and 1 deletions

View File

@ -462,7 +462,12 @@ void GRID_TRICKS::onCharHook( wxKeyEvent& ev )
if( ( ev.GetKeyCode() == WXK_RETURN || ev.GetKeyCode() == WXK_NUMPAD_ENTER )
&& m_grid->GetGridCursorRow() == m_grid->GetNumberRows() - 1 )
{
if( m_grid->CommitPendingChanges() )
if( m_grid->IsCellEditControlShown() )
{
if( m_grid->CommitPendingChanges() )
handled = true;
}
else
{
wxCommandEvent dummy;
m_addHandler( dummy );