Added command to set wxPG_PROP_READONLY in the propgrid sample

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63336 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli 2010-01-31 18:14:24 +00:00
parent 34c921fc4d
commit 8669431add
2 changed files with 18 additions and 0 deletions

View File

@ -644,6 +644,7 @@ enum
ID_INSERTPROP,
ID_INSERTCAT,
ID_ENABLE,
ID_SETREADONLY,
ID_HIDE,
ID_DELETE,
ID_DELETER,
@ -748,6 +749,7 @@ BEGIN_EVENT_TABLE(FormMain, wxFrame)
EVT_MENU( ID_UNSPECIFY, FormMain::OnMisc )
EVT_MENU( ID_DELETEALL, FormMain::OnClearClick )
EVT_MENU( ID_ENABLE, FormMain::OnEnableDisable )
EVT_MENU( ID_SETREADONLY, FormMain::OnSetReadOnly )
EVT_MENU( ID_HIDE, FormMain::OnHideShow )
EVT_MENU( ID_ITERATE1, FormMain::OnIterate1Click )
@ -2284,6 +2286,8 @@ FormMain::FormMain(const wxString& title, const wxPoint& pos, const wxSize& size
wxT("Toggles item's enabled state.") );
m_itemEnable->Enable( FALSE );
menuTools1->Append(ID_HIDE, wxT("Hide"), wxT("Shows or hides a property") );
menuTools1->Append(ID_SETREADONLY, "Set as Read-Only",
"Set property as read-only" );
menuTools2->Append(ID_ITERATE1, wxT("Iterate Over Properties") );
menuTools2->Append(ID_ITERATE2, wxT("Iterate Over Visible Items") );
@ -2731,6 +2735,19 @@ void FormMain::OnEnableDisable( wxCommandEvent& )
// -----------------------------------------------------------------------
void FormMain::OnSetReadOnly( wxCommandEvent& WXUNUSED(event) )
{
wxPGProperty* p = m_pPropGridManager->GetGrid()->GetSelection();
if ( !p )
{
wxMessageBox(wxT("First select a property."));
return;
}
m_pPropGridManager->SetPropertyReadOnly(p);
}
// -----------------------------------------------------------------------
void FormMain::OnHideShow( wxCommandEvent& WXUNUSED(event) )
{
wxPGProperty* id = m_pPropGridManager->GetGrid()->GetSelection();

View File

@ -185,6 +185,7 @@ public:
void OnContextMenu( wxContextMenuEvent& event );
void OnEnableDisable( wxCommandEvent& event );
void OnSetReadOnly( wxCommandEvent& event );
void OnHideShow( wxCommandEvent& event );
void OnSetBackgroundColour( wxCommandEvent& event );
void OnClearModifyStatusClick( wxCommandEvent& event );