Page 1 of 1

wxpropertygrid multiple columns

Posted: Tue Sep 25, 2012 6:23 am
by hackish
I've created a wxpropertygrid and using pgrid->SetColumnCount(3) I've managed to create 3 columns.

How can I access this extra column so an additional property can be displayed in it? Does the extra column sort of belong to the wxFloatProperty I create for that row? In my case I want to add units to the last column (mph).

-Michael

Re: wxpropertygrid multiple columns

Posted: Tue Sep 25, 2012 7:42 am
by doublemax
From the "propgrid" sample:

Code: Select all

pg->Append( new wxIntProperty(wxT("Width"),wxPG_LABEL,640) );
pg->SetPropertyAttribute(wxT("Width"), wxPG_ATTR_MIN, (long)10 );
pg->SetPropertyAttribute(wxT("Width"), wxPG_ATTR_MAX, (long)2048 );
pg->SetPropertyAttribute(wxT("Width"), wxPG_ATTR_UNITS, wxT("Pixels") );
wxPG_ATTR_UNITS is what you're looking for.

Re: wxpropertygrid multiple columns

Posted: Fri Dec 10, 2021 5:43 pm
by itachiboi999
doublemax wrote: Tue Sep 25, 2012 7:42 am From the "propgrid" sample:

Code: Select all

pg->Append( new wxIntProperty(wxT("Width"),wxPG_LABEL,640) );
pg->SetPropertyAttribute(wxT("Width"), wxPG_ATTR_MIN, (long)10 );
pg->SetPropertyAttribute(wxT("Width"), wxPG_ATTR_MAX, (long)2048 );
pg->SetPropertyAttribute(wxT("Width"), wxPG_ATTR_UNITS, wxT("Pixels") );
wxPG_ATTR_UNITS is what you're looking for.
i've been able to add as many columns as needed, but I've been having issues trying to reorder the columns (not sure if it's even possible)

For my application i want to have a bit-field column before the title column, but this has been proposing issues as the left-most column is the title column by default and is what's used to tie other attributes to the row... so is there a way to restructure the columns to allow me to reference the second column as the name column and have a bit-field attribute as the first column?

Code: Select all

			//add property grid
			wxPropertyGrid* regProp = new wxPropertyGrid(
				panel_right, // parent
				wxID_ANY, // id
				wxDefaultPosition, // position
				wxSize(400, 200), // size
				wxPG_SPLITTER_AUTO_CENTER | // Automatically center splitter until user manually adjusts it
				// Default style
				wxPG_DEFAULT_STYLE);
			regProp->SetColumnCount(4);
			regProp->SetExtraStyle(wxPG_EX_HELP_AS_TOOLTIPS);

			//label
			regProp->Append(new wxLongStringProperty(wxT("A Label For Values"),
				wxPG_LABEL,
				wxT("Value itself")
				wxT("...")));
			regProp->SetPropertyAttribute(wxT("A Label For Values"), wxPG_ATTR_UNITS, wxT("Permissions"));
			regProp->SetPropertyCell(wxT("A Label For Values"), 3, wxString("Permissions"), wxBitmap(wxNullBitmap), wxColour(100, 100, 100));
			regProp->SetPropertyCell(wxT("A Label For Values"), 4, wxString("Bit-Field"), wxBitmap(wxNullBitmap), wxColour(100, 200, 100));
additionally, as it's visible in the code and my attached image, i am currently unable to both name the 4th cell and unable to edit the color of any individual cell... I have tried to utilize SetPropertyCell() to do these actions, but I haven't had any success thus far

Any advice and assistance is appreciated!!
Thanks in advance!!

Image