From 02af9b02958a8456c87393af158f193eca72d370 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Fri, 12 Mar 2021 20:35:06 +0100 Subject: [PATCH] Add option to demonstrate disabled wxPropertyGrid in propgrid sample --- samples/propgrid/propgrid.cpp | 10 ++++++++++ samples/propgrid/propgrid.h | 1 + 2 files changed, 11 insertions(+) diff --git a/samples/propgrid/propgrid.cpp b/samples/propgrid/propgrid.cpp index c135f6c787..587bf19e11 100644 --- a/samples/propgrid/propgrid.cpp +++ b/samples/propgrid/propgrid.cpp @@ -420,6 +420,7 @@ enum ID_TESTREPLACE, ID_SETCOLUMNS, ID_SETVIRTWIDTH, + ID_SETPGDISABLED, ID_TESTXRC, ID_ENABLECOMMONVALUES, ID_SELECTSTYLE, @@ -521,6 +522,7 @@ wxBEGIN_EVENT_TABLE(FormMain, wxFrame) EVT_MENU( ID_CATCOLOURS, FormMain::OnCatColours ) EVT_MENU( ID_SETCOLUMNS, FormMain::OnSetColumns ) EVT_MENU( ID_SETVIRTWIDTH, FormMain::OnSetVirtualWidth ) + EVT_MENU( ID_SETPGDISABLED, FormMain::OnSetGridDisabled ) EVT_MENU( ID_TESTXRC, FormMain::OnTestXRC ) EVT_MENU( ID_ENABLECOMMONVALUES, FormMain::OnEnableCommonValues ) EVT_MENU( ID_SELECTSTYLE, FormMain::OnSelectStyle ) @@ -2056,6 +2058,7 @@ FormMain::FormMain(const wxString& title, const wxPoint& pos, const wxSize& size "Renders Boolean values as checkboxes"); menuTry->Append(ID_SETCOLUMNS, "Set Number of Columns" ); menuTry->Append(ID_SETVIRTWIDTH, "Set Virtual Width"); + menuTry->AppendCheckItem(ID_SETPGDISABLED, "Disable Grid"); menuTry->AppendSeparator(); menuTry->Append(ID_TESTXRC, "Display XRC sample" ); @@ -2939,6 +2942,13 @@ void FormMain::OnSetVirtualWidth(wxCommandEvent& WXUNUSED(evt)) // ----------------------------------------------------------------------- +void FormMain::OnSetGridDisabled(wxCommandEvent& evt) +{ + m_pPropGridManager->Enable(!evt.IsChecked()); +} + +// ----------------------------------------------------------------------- + void FormMain::OnSetPropertyValue( wxCommandEvent& WXUNUSED(event) ) { wxPropertyGrid* pg = m_pPropGridManager->GetGrid(); diff --git a/samples/propgrid/propgrid.h b/samples/propgrid/propgrid.h index 7eea92f3e8..c4ccd584dd 100644 --- a/samples/propgrid/propgrid.h +++ b/samples/propgrid/propgrid.h @@ -199,6 +199,7 @@ public: void OnCatColours( wxCommandEvent& event ); void OnSetColumns( wxCommandEvent& event ); void OnSetVirtualWidth(wxCommandEvent& evt); + void OnSetGridDisabled(wxCommandEvent& evt); void OnMisc( wxCommandEvent& event ); void OnPopulateClick( wxCommandEvent& event ); void OnSetSpinCtrlEditorClick( wxCommandEvent& event );