Add to propgrid sample an option to change virtual width of the grid

This commit is contained in:
Artur Wieczorek
2018-12-27 09:04:37 +01:00
parent 311e5e8414
commit 8dbe6ec69d
2 changed files with 24 additions and 0 deletions

View File

@@ -422,6 +422,7 @@ enum
ID_SETPROPERTYVALUE,
ID_TESTREPLACE,
ID_SETCOLUMNS,
ID_SETVIRTWIDTH,
ID_TESTXRC,
ID_ENABLECOMMONVALUES,
ID_SELECTSTYLE,
@@ -522,6 +523,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_TESTXRC, FormMain::OnTestXRC )
EVT_MENU( ID_ENABLECOMMONVALUES, FormMain::OnEnableCommonValues )
EVT_MENU( ID_SELECTSTYLE, FormMain::OnSelectStyle )
@@ -2120,6 +2122,7 @@ FormMain::FormMain(const wxString& title, const wxPoint& pos, const wxSize& size
menuTry->AppendCheckItem(ID_BOOL_CHECKBOX, "Render Boolean values as checkboxes",
"Renders Boolean values as checkboxes");
menuTry->Append(ID_SETCOLUMNS, "Set Number of Columns" );
menuTry->Append(ID_SETVIRTWIDTH, "Set Virtual Width");
menuTry->AppendSeparator();
menuTry->Append(ID_TESTXRC, "Display XRC sample" );
@@ -2943,6 +2946,26 @@ void FormMain::OnSetColumns( wxCommandEvent& WXUNUSED(event) )
// -----------------------------------------------------------------------
void FormMain::OnSetVirtualWidth(wxCommandEvent& WXUNUSED(evt))
{
long oldWidth = m_pPropGridManager->GetState()->GetVirtualWidth();
long newWidth = oldWidth;
{
wxNumberEntryDialog dlg(this, "Enter virtual width (-1-2000).", "Width:",
"Change Virtual Width", oldWidth, -1, 2000);
if ( dlg.ShowModal() == wxID_OK )
{
newWidth = dlg.GetValue();
}
}
if ( newWidth != oldWidth )
{
m_pPropGridManager->GetGrid()->SetVirtualWidth((int)newWidth);
}
}
// -----------------------------------------------------------------------
void FormMain::OnSetPropertyValue( wxCommandEvent& WXUNUSED(event) )
{
wxPropertyGrid* pg = m_pPropGridManager->GetGrid();