A list with buttons Topic is solved

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
Maeglix
Experienced Solver
Experienced Solver
Posts: 74
Joined: Thu Nov 17, 2016 8:07 am

A list with buttons

Post by Maeglix »

Hi everyone,

I will start by explain to you what i want to do, the question will be probably more clear after that.

For some reasons, i have to manage some rules.
Those rules are visible in a list in a specific tab.
At start, there is no rule but the user can add and remove rules.
As the rules have priority i would like the user to be able to move the order of the list.

In my head it would be something like that:
Image

The problem is that i don't find any kind of list that accepts button inside.

So the question is: is it me who didn't find the good control or is there no control to do that ? And if the last, is there any other way to do what i want ?
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: A list with buttons

Post by doublemax »

If you're using wxWidgets 3.x, check out wxRearrangeDialog and wxAddRemoveCtrl. Unfortunately none of them is perfect for your task.

wxRearrangeDialog has the problem that it also has checkboxes for each item that can not be removed.
wxAddRemoveCtrl is only available in wx 3.1 (latest development version) and has no option to re-order the items.

Check the "dialogs" sample that comes with wxWidgets to see them in action (Dialogs menu -> Choices and selectors)
Use the source, Luke!
Maeglix
Experienced Solver
Experienced Solver
Posts: 74
Joined: Thu Nov 17, 2016 8:07 am

Re: A list with buttons

Post by Maeglix »

Ok thank you for your help.

I will try that tomorrow, i don't have the time today.
But i don't think that the rearranged dialog will help me. My list would be on a tab of a notebook and so it is constant, not like a dialog (i don't know if this sentence was clear. Ask me if not).

If those 2 solutions don't fit with what i want i will have no other choice than create something myself right ?
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: A list with buttons

Post by doublemax »

But i don't think that the rearranged dialog will help me. My list would be on a tab of a notebook and so it is constant, not like a dialog
There is also a wxRearrangeCtrl which you can embed like any other control.
If those 2 solutions don't fit with what i want i will have no other choice than create something myself right ?
Yes. But i would suggest a different layout which should be easier to implement. I would use a wxListBox with external buttons for moving and deleting the currently selected item. I also think that solution would be better from a user's point of view. Just imagine you wanted to move one item from the bottom to the top. Each time you clicked the "up" button, you'd have to follow the item with the mouse to click the "up" button again. With external buttons, you just just click on "up" several times until the item is at the correct position.
Use the source, Luke!
Maeglix
Experienced Solver
Experienced Solver
Posts: 74
Joined: Thu Nov 17, 2016 8:07 am

Re: A list with buttons

Post by Maeglix »

Ok i tested and i think i can do what i want with the rearrangectrl thanks !
Post Reply