How to handle a repeated wxWidgets Group

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Mungo1981
Experienced Solver
Experienced Solver
Posts: 86
Joined: Wed Jan 30, 2019 5:42 pm

How to handle a repeated wxWidgets Group

Post by Mungo1981 »

Dear Community,
I have following problem:
I need a Group of wxWidgets repeated in a Panel.
Is it a Set of Controls which control the main Parameter of a Sound-track.
So the user should have the option to add and remove this Control by pressing wxButtons.
And this is my first idea to solve this Problem:
So my first idea is to put this Controls in one Function to there Panel,
and to add the Pointers of the Controls to a array.
But then I have the following Problem:
I need a Button in this Control to remove the complete Control.
And I need in the Control two Panels with Events that fire by pressing, to control parameter of the special Track.
And So I have no idea in what way I can handle the ID of this Events.

And just my question:
Is my idea with the array good, or gives it a other solution ???
And in what way can I handle the problem with the ID's ???

A little newbie to this point
Mungo 1981
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to handle a repeated wxWidgets Group

Post by doublemax »

Create a custom control that contains all the repeating controls. Handle all events inside this control, so that it doesn't interfere with other instances of it. As you will have to use wxID_ANY instead of hard-coded IDs for the controls, you need to connect all event handlers with Bind() directly instead of using a static event table.
Use the source, Luke!
Mungo1981
Experienced Solver
Experienced Solver
Posts: 86
Joined: Wed Jan 30, 2019 5:42 pm

Re: How to handle a repeated wxWidgets Group

Post by Mungo1981 »

Ok,
this way I will try.
Post Reply