I have a project coming up that needs a listbox with columns that the user can drag into a different order, or hide (or collapse to zero width). They also need to be able to drag rows up and down the list, and edit each cell’s content directly within the listbox grid (no separate edit field). Multiple cell selections are also a must, as are custom mouse cursors.
I suspect the Xojo listbox could do all of this, but it would take a lot of time/programming to make it happen. So I’m hoping that someone has a commercial listbox plugin that can do it. I’ve looked at Graffitti and the MBS listbox, but I can’t tell much about the Graffitti listbox dragging and column width features, and the MBS listbox appears to be macOS only. This project has to be Mac and Windows.
It can, but I’m not sure that a commercial listbox would make it any easier.
Setting these properties in the IDE is a start:
If dragging a row requires an underlying data change, thats something you need to code.
if one column is resizing and you would rather it didn’t, you need to trap that.
You set the state of cells to be editable in code before you populate.
The only thing I cant envisage here is multiple CELL selection… multi ROW is fine…
here a sample code with a multiple cell selection, done with a listbox subclass
don’t remember where I found it, it is not my code.
and there is no about text. so take it as it is.
Just FYI, I tried the draggable columns things a while back and the only solution that I came up with required the use of DrawInto which IIRC does not work when the mouse is pressed on Windows.
Basically, the idea was to detect a mouse click in a header, use DrawInto to grab just that column and use that as the drag image. As the user drags, you can instruct the cells in a column to draw the drag cursor for the column the cursor is over.
If you are open to third party solutions, try the demo of piDog’s DataView as it can probably do all you want plus a WHOLE lot more. Prices range from $60 - 349 USD depending on if you want source too or just an encrypted module.
You can not only let the user drag columns around, but you can opt to refer to them in code by your original sequence instead of the new sequence. Row heights can be adjusted too. Cells can span multiple columns and/or multiple rows. Cells may have containers, making the infinitely customizable. Etc. LOTS of features beyond a standard Xojo Listbox. (Not subclassed from Listbox; built entirely upon a canvas control.)
Yes, that’s the tough one, I’ll give DrawInto a try just to explore the possibilities. Thanks!
Dragging rows is something I’ve already implemented on one of my windows, so that part’s pretty straightforward. It’s the column-order rearranging that’s complicated and is something that I think Xojo should add to the native listbox.
I’d forgotten about iDog, will check it out
I did this column drag with new picture, drawing the column content, in a dropitem in the mousedrag event of the listbox
it’s almost working, but the dropped column doesn’t go where I want so it’s not usable like that.
I don’t recall where I’ve got it from, may be from some alex restrepo code,
but I can’t find it on my drive. still looking for it.