Simple Question - Re-Arranging Items

I am giving Xojo a go after many years of being out of this kind of stuff. I started working on a simple form a short while ago, but I am shocked that I can’t see a way to do this. It seems like such a simple and absolutely needed thing. I must surely be missing something super simple because I can’t imagine this not being possible. I have this dropdown list: atrt

How do I re-arrange the items? Surely you don’t have to start over every time you need to add a new item and need them to be in a certain order? For example, if I had 15 items in the list (alphabetical order), and needed to add one, must I deleted them all, add the new one, and then add them all back?!

Drag to reorder is what you want?: (8)

1 Like

I did try to do exactly that. Let me try again…

Indeed. It does not work. When I click to “initiate” the drag and drop process, it goes into edit of the name of the item. I am using Windows if that matters.

asking here as there is some context …
is there somewhere a working open source example of hierarchical listbox, with row reordering ?
I did not succeed in making one…
(but I did with a non-hierarchical one…)

Yes, it feels little tricky, if you click one that is already selected it goes to edit, you need to click something that is not selected and start the drag: (9)

With some difficulty, I made it work, but I wouldn’t like to have to understand again how I did it. Most of the code is in the DragReorderRows event. I also have an SQLite database whose contents reflect the organisation of the listbox. This is kept in sync as rows are moved around or dropped on a folder.

Using a Windows VM: (10)

I solved this by adding a second small column, with only a small icon in it meaning “I can be dragged”, and that is a non editable cell. this way, you always start a drag if you clic on the icon.

Enregistrement de l’écran 2023-04-03 à 23_05_48

That’s a great idea.

Do you know if there is a feature request to add a small column with just an icon like:
so is easy to reorder the elements in a Xojo popupmenu or other control?

Edit: I see you added a GIF with what you did. Very good.

1 Like

is this one an unicode character ?

No, sorry, is just the first image I got from Google search.

Thank you very much! Worked great now that I know the trick!

1 Like

I will create a Feature Request and point to this topic.
It shouldn’t be that hard to reorder rows in Xojo controls.

Edit: feature request:
#72341 - Is hard to reorder items on a PopupMenu (and other controls), can you add an icon to reorder?

Also, instead of using the Pencil on the control, you can add the options using the Inspector - Initial Value and just paste the text in the order you want:

Wouldn’t you use AddRowAt to insert the new item in the correct order?