Add a menu item to start editing the cell to grid sample

Show that this is done using EnableCellEditControl() and not
ShowCellEditControl(), as might have been expected.
This commit is contained in:
Vadim Zeitlin 2019-10-12 17:46:18 +02:00
parent 18c9d7375b
commit b66a4b9948
2 changed files with 9 additions and 0 deletions

View File

@ -183,6 +183,7 @@ wxBEGIN_EVENT_TABLE( GridFrame, wxFrame )
EVT_MENU( ID_DELETEROW, GridFrame::DeleteSelectedRows )
EVT_MENU( ID_DELETECOL, GridFrame::DeleteSelectedCols )
EVT_MENU( ID_CLEARGRID, GridFrame::ClearGrid )
EVT_MENU( ID_EDITCELL, GridFrame::EditCell )
EVT_MENU( ID_SETCORNERLABEL, GridFrame::SetCornerLabelValue )
EVT_MENU( ID_SHOWSEL, GridFrame::ShowSelection )
EVT_MENU( ID_SELCELLS, GridFrame::SelectCells )
@ -372,6 +373,7 @@ GridFrame::GridFrame()
editMenu->Append( ID_DELETEROW, "Delete selected ro&ws" );
editMenu->Append( ID_DELETECOL, "Delete selected co&ls" );
editMenu->Append( ID_CLEARGRID, "Cl&ear grid cell contents" );
editMenu->Append( ID_EDITCELL, "&Edit current cell" );
editMenu->Append( ID_SETCORNERLABEL, "&Set corner label..." );
editMenu->AppendCheckItem( ID_FREEZE_OR_THAW, "Freeze up to cursor\tCtrl-F" );
@ -1161,6 +1163,11 @@ void GridFrame::ClearGrid( wxCommandEvent& WXUNUSED(ev) )
grid->ClearGrid();
}
void GridFrame::EditCell( wxCommandEvent& WXUNUSED(ev) )
{
grid->EnableCellEditControl();
}
void GridFrame::SetCornerLabelValue( wxCommandEvent& WXUNUSED(ev) )
{
wxTextEntryDialog dialog(this,

View File

@ -69,6 +69,7 @@ class GridFrame : public wxFrame
void DeleteSelectedRows( wxCommandEvent& );
void DeleteSelectedCols( wxCommandEvent& );
void ClearGrid( wxCommandEvent& );
void EditCell( wxCommandEvent& );
void SetCornerLabelValue( wxCommandEvent& );
void ShowSelection( wxCommandEvent& );
void SelectCells( wxCommandEvent& );
@ -179,6 +180,7 @@ public:
ID_DELETEROW,
ID_DELETECOL,
ID_CLEARGRID,
ID_EDITCELL,
ID_SETCORNERLABEL,
ID_SHOWSEL,
ID_CHANGESEL,