Page 1 of 1

optional expandable/collabsible rows

Posted: Mon Oct 14, 2019 9:21 pm
by sg_wa
Hi there, I'm new to WX UIs and had what I hope is a simple question. I've inherited some old wx-based c++ code for a utility which displays a table where the row is an object and three columns display metrics about that object. The table is periodically updated with current values.
In the past this was simple because each object had a single set of three metrics.
Now I have new objects which have child-objects, each having their own set of the same 3 metrics. So in the case there are child objects, I'd like to have the parent row display the summed or averaged metrics for the whole parent object, and the child rows would each show their individual metrics.
The way i'm hoping to incorporate these objects with children is to keep it's parent-row visible and child rows hidden by default. There would be a little (+) button to the left of the parent row to expand or collapse the child rows.

I wonder if there's a built-in widget that would completely do this for me or if I have to build it using lower level widgets?
I saw the wxCollapsiblePane, but I'd prefer to have a small (+) button to the left of the main row rather than turning the entire parent row into a button.
Thanks for any insights. Anything is helpful, I've been looking around but I'm starting at zero. :)

Re: optional expandable/collabsible rows

Posted: Mon Oct 14, 2019 9:46 pm
by doublemax
In a case like this a screenshot would have been helpful to understand what you need.

But i think wxDataViewCtrl is the only control that could be able to do what you need. Build and run the "dataview" sample that comes with wxWidgets. It should give you an idea if it's good enough for your purpose.

Re: optional expandable/collabsible rows

Posted: Mon Oct 14, 2019 9:48 pm
Take a look at wxTreeListCtrl.
Also - look at wxCode website for the same control.

The API for them is a little different, but you should be able to get the idea.

Thank you.