optional expandable/collabsible rows

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
sg_wa
In need of some credit
In need of some credit
Posts: 1
Joined: Mon Oct 14, 2019 3:58 pm

optional expandable/collabsible rows

Post by sg_wa » Mon Oct 14, 2019 9:21 pm

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. :)
Thanks,
Stuart

User avatar
doublemax
Moderator
Moderator
Posts: 14594
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: optional expandable/collabsible rows

Post by doublemax » Mon Oct 14, 2019 9:46 pm

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.
Use the source, Luke!

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3870
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: optional expandable/collabsible rows

Post by ONEEYEMAN » Mon Oct 14, 2019 9:48 pm

Hi,
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.

Post Reply