ID_INSERTPROP,
ID_INSERTCAT,
ID_ENABLE,
+ ID_SETREADONLY,
ID_HIDE,
ID_DELETE,
ID_DELETER,
EVT_MENU( ID_UNSPECIFY, FormMain::OnMisc )
EVT_MENU( ID_DELETEALL, FormMain::OnClearClick )
EVT_MENU( ID_ENABLE, FormMain::OnEnableDisable )
- EVT_MENU( ID_HIDE, FormMain::OnHideShow )
+ EVT_MENU( ID_SETREADONLY, FormMain::OnSetReadOnly )
+ EVT_MENU( ID_HIDE, FormMain::OnHide )
EVT_MENU( ID_ITERATE1, FormMain::OnIterate1Click )
EVT_MENU( ID_ITERATE2, FormMain::OnIterate2Click )
// an empty value cell, while help string is shown either in the
// description text box, as a tool tip, or on the status bar.
pg->SetPropertyHelpString("Height",
- "This property uses attributes \"Units\" and \"InlineHelp\"." );
+ "This property uses attributes \"Units\" and \"Hint\"." );
pg->Append( new wxIntProperty(wxT("Width"),wxPG_LABEL,640) );
pg->SetPropertyAttribute(wxT("Width"), wxPG_ATTR_MIN, (long)10 );
pg->SetPropertyAttribute(wxT("Width"), wxPG_ATTR_UNITS, wxT("Pixels") );
pg->SetPropertyValueUnspecified(wxT("Width"));
- pg->SetPropertyAttribute(wxT("Width"), wxPG_ATTR_INLINE_HELP, wxT("Enter new width for window") );
- pg->SetPropertyHelpString(wxT("Width"), wxT("This property uses attributes \"Units\" and \"InlineHelp\".") );
+ pg->SetPropertyAttribute("Width", wxPG_ATTR_HINT,
+ "Enter new width for window" );
+ pg->SetPropertyHelpString("Width",
+ "This property uses attributes \"Units\" and \"Hint\"." );
pg->Append( new wxIntProperty(wxT("X"),wxPG_LABEL,10) );
pg->SetPropertyAttribute(wxT("X"), wxPG_ATTR_UNITS, wxT("Pixels") );
wxPropertyGridManager* pgman = m_pPropGridManager;
wxPropertyGridPage* pg = pgman->GetPage(wxT("wxWidgets Library Config"));
+ // Set custom column proportions (here in the sample app we need
+ // to check if the grid has wxPG_SPLITTER_AUTO_CENTER style. You usually
+ // need not to do it in your application).
+ if ( pgman->HasFlag(wxPG_SPLITTER_AUTO_CENTER) )
+ {
+ pg->SetColumnProportion(0, 3);
+ pg->SetColumnProportion(1, 1);
+ }
+
wxPGProperty* cat;
wxBitmap bmp = wxArtProvider::GetBitmap(wxART_REPORT_VIEW);
pid = pg->Append( new wxPropertyCategory( wxT("wxWidgets Library Configuration") ) );
pg->SetPropertyCell( pid, 0, wxPG_LABEL, bmp );
+ // Both of following lines would set a label for the second column
+ pg->SetPropertyCell( pid, 1, "Is Enabled" );
+ pid->SetValue("Is Enabled");
+
ADD_WX_LIB_CONF_GROUP(wxT("Global Settings"))
ADD_WX_LIB_CONF( wxUSE_GUI )
m_itemEnable = menuTools1->Append(ID_ENABLE, wxT("Enable"),
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_HIDE, "Hide", "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") );
// -----------------------------------------------------------------------
-void FormMain::OnHideShow( wxCommandEvent& WXUNUSED(event) )
+void FormMain::OnSetReadOnly( wxCommandEvent& WXUNUSED(event) )
{
- wxPGProperty* id = m_pPropGridManager->GetGrid()->GetSelection();
- if ( !id )
+ wxPGProperty* p = m_pPropGridManager->GetGrid()->GetSelection();
+ if ( !p )
{
wxMessageBox(wxT("First select a property."));
return;
}
+ m_pPropGridManager->SetPropertyReadOnly(p);
+}
- if ( m_pPropGridManager->IsPropertyShown( id ) )
- {
- m_pPropGridManager->HideProperty( id, true );
- m_itemEnable->SetItemLabel( wxT("Show") );
- }
- else
- {
- m_pPropGridManager->HideProperty( id, false );
- m_itemEnable->SetItemLabel( wxT("Hide") );
- }
-
- wxPropertyGridPage* curPage = m_pPropGridManager->GetCurrentPage();
-
- // Check for bottomY precalculation validity
- unsigned int byPre = curPage->GetVirtualHeight();
- unsigned int byAct = curPage->GetActualVirtualHeight();
+// -----------------------------------------------------------------------
- if ( byPre != byAct )
+void FormMain::OnHide( wxCommandEvent& WXUNUSED(event) )
+{
+ wxPGProperty* id = m_pPropGridManager->GetGrid()->GetSelection();
+ if ( !id )
{
- wxLogDebug(wxT("VirtualHeight is %u, should be %u"), byPre, byAct);
+ wxMessageBox(wxT("First select a property."));
+ return;
}
+
+ m_pPropGridManager->HideProperty( id, true );
}
// -----------------------------------------------------------------------