How to write Unity style grid property?

Are you writing your own components and need help with how to set them up or have questions about the components you are deriving from ? Ask them here.
beyondlwm
Experienced Solver
Experienced Solver
Posts: 85
Joined: Sun Jan 29, 2012 8:37 am

How to write Unity style grid property?

Postby beyondlwm » Tue Feb 16, 2016 8:44 am

QQ图片20160216164311.png
QQ图片20160216164311.png (21.48 KiB) Viewed 1185 times


Two float property can be in same row. with an extra button.

New Pagodi
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 248
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: How to write Unity style grid property?

Postby New Pagodi » Tue Feb 16, 2016 10:05 pm

The closest out of the box tool included with wxWidgets is of course wxPropertyGrid. It only has 2 columns though.

Another option, although it will be a bit of a pain is to use something like the accordion control I wrote a while back. Using the builder sample, I was able to get this close:

acc.png
acc.png (6.93 KiB) Viewed 1162 times


You could then add panels with a flex grid sizer or a grid bag sizer to hold the labels and the controls for changing the properties to the accordion.

Another possibility would be to use a wxGrid and add the grid to the accordion. But you'll have to set custom renderers and editors for the grid to get the checkboxes and things.

If that seems close enough for you, here is the code from the builder sample to generate the accordion above:

Code: Select all

wxAccordion* m_accordion;
m_accordion = new wxAccordion( <insert parent here> );
m_accordion->SetAccordionPadding(0);
m_accordion->SetBackgroundColour( wxColour(56,56,56) );
m_accordion->SetCaptionRadius(5);
m_accordion->SetExpandButton( wxBitmap("<your file here>",wxBITMAP_TYPE_ANY) );
m_accordion->SetCollapseButton( wxBitmap("<your file here>",wxBITMAP_TYPE_ANY) );
wxImageList* m_imagelist = new wxImageList(16,16);
\Add icons to the image list here.
m_accordion->AssignImageList(m_imagelist);
m_accordion->GetCollapsedStyle().SetColour1( wxColour(87,87,87) );
m_accordion->GetCollapsedStyle().SetColour2( wxColour(87,87,87) );
m_accordion->GetCollapsedStyle().SetTextColour( wxColour(201,201,201) );
m_accordion->GetExpandedStyle().SetColour1( wxColour(87,87,87) );
m_accordion->GetExpandedStyle().SetColour2( wxColour(87,87,87) );
m_accordion->GetPageStyle().SetColour1( wxColour(60,60,60) );
m_accordion->GetPageStyle().SetColour2( wxColour(60,60,60) );
m_accordion->GetPageStyle().SetBorderColour( wxColour(40,40,40) );

beyondlwm
Experienced Solver
Experienced Solver
Posts: 85
Joined: Sun Jan 29, 2012 8:37 am

Re: How to write Unity style grid property?

Postby beyondlwm » Wed Feb 17, 2016 2:21 am

Hi,

The accordion control is very cool, it can resolve some of our problem for sure.
However, we have already heavily lean on property grid, so I have to find a way out in property grid.

Regards


Return to “Component Writing”

Who is online

Users browsing this forum: No registered users and 4 guests