diff --git a/src/LabelDialog.cpp b/src/LabelDialog.cpp index 2b38d14e8..048eeb1ca 100644 --- a/src/LabelDialog.cpp +++ b/src/LabelDialog.cpp @@ -130,6 +130,7 @@ void LabelDialog::PopulateLabels() // Build the initial (empty) grid mGrid->CreateGrid(0, Col_Max, wxGrid::wxGridSelectRows); mGrid->SetDefaultCellAlignment(wxALIGN_LEFT, wxALIGN_CENTER); + mGrid->SetRowLabelSize(0); size_t ii = 0; for ( const auto &label : { diff --git a/src/widgets/Grid.cpp b/src/widgets/Grid.cpp index 87bd36263..38ad44c14 100644 --- a/src/widgets/Grid.cpp +++ b/src/widgets/Grid.cpp @@ -468,6 +468,7 @@ BEGIN_EVENT_TABLE(Grid, wxGrid) EVT_SET_FOCUS(Grid::OnSetFocus) EVT_KEY_DOWN(Grid::OnKeyDown) EVT_GRID_SELECT_CELL(Grid::OnSelectCell) + EVT_GRID_EDITOR_SHOWN(Grid::OnEditorShown) END_EVENT_TABLE() Grid::Grid(wxWindow *parent, @@ -500,6 +501,8 @@ Grid::Grid(wxWindow *parent, safenew wxGridCellStringRenderer, safenew ChoiceEditor); + // Bug #2803: + // Ensure selection doesn't show up. SetSelectionForeground(GetDefaultCellTextColour()); SetSelectionBackground(GetDefaultCellBackgroundColour()); } @@ -534,6 +537,15 @@ void Grid::OnSelectCell(wxGridEvent &event) #endif } +void Grid::OnEditorShown(wxGridEvent &event) +{ + event.Skip(); + + // Bug #2803 (comment 7): + // Select row whenever an editor is displayed + SelectRow(GetGridCursorRow()); +} + void Grid::OnKeyDown(wxKeyEvent &event) { auto keyCode = event.GetKeyCode(); diff --git a/src/widgets/Grid.h b/src/widgets/Grid.h index f81fc66ab..7f19cee5f 100644 --- a/src/widgets/Grid.h +++ b/src/widgets/Grid.h @@ -210,6 +210,7 @@ class Grid final : public wxGrid void OnSetFocus(wxFocusEvent &event); void OnSelectCell(wxGridEvent &event); + void OnEditorShown(wxGridEvent &event); void OnKeyDown(wxKeyEvent &event); private: