I'm looking for a more advanced listbox

I’m an old 4D programmer, sorry for my trivial questions, I’m doing a product evaluation in replacement of 4D, so I have a lot of questions to ask, sorry in advance, I saw that the listbox is the a bit limited, I was expecting something more evolved, e.g. possibility to insert buttons, popups, images, in my case I was also used to the possibility of multi-style (html integration), let’s say a respectable grid. Maybe there is a very advanced listbox that I don’t know about and someone can give me tips, or simply there is a possibility to program it and make it more functional. I look forward to your valuable help.

in the listbox you can paint images, see events PaintCellBackground and PaintCellText
a button would be CellPressed event.
DesktopListBox have only CellTypes Normal, CheckBox, TextField or TextArea
context menu see ConstructContextualMenu and ContextualMenuItemSelected

a grid control is on the road map mentioned …
https://documentation.xojo.com/resources/roadmap.html

could you post a screenshot how your listbox capabilities was at 4D?

product evaluation

Apple Xcode SwiftUI have a very flexible layout concept …

The DesktopListbox is good in some ways and poor in others (arguably). In my case I use the standard one in a variety of roles, such as a view of a file system (or specific parts of it), including expanding folder to show their contents, and drag/drop of folders/files to other points in the displayed file system. Another instance of this contains a column with a checkbox to allow the user to make a selection of the files for exporting purposes.

I also use a listbox to display data, ignoring the supplied row-select facilty. I rolled my own for that because I need to have one selected row which is more important than other selected rows. These are therefore shown with different hightlight colours. Some columns in this table contain small images.

The listbox is not Excel. So you can’t merge columns in certain rows or rows in certain columns. AFAIK, all rows are the same height; column widths are varable. You can have a header row and clicking on a header allows row sorting to be implemented (me, I just reload the listbox while changing the ORDER BY in my SELECT.

I understand other listbox offerings are available from various people but I’ve not looked at them.

I come from 4D too, but 15 years ago …
I made my own listbox to have something similar to 4D (and almost all other controls from 4D)
it took me a few years to have it usable (and far better than 4D now and going on …)
I used a container control, with the standard listbox in it (not needed the desktoplistbox), and two scrollbars
and linked it to my database methods (also had to write a lot from 4D to Xojo)
If you’re in a hurry, you can look at third party tools like graffiti or pidog they have good listboxes
or wait for xojo grid like Marcus said above, but nobody knows how long it will take.

edit: there is also a new one here : Xojo DataGrid by BasicApp

1 Like

I suggest a ContainerControl ‘list’. That way your ‘row’ can have any control you want. This is not as convenient as the listbox but you get to control how you want it.

I suggest trying this in a small proof of concept project before jumping in with your bigger project. When I’ve done this I create an overall outer container and use similar methods and events to the ListBox. In this container is the scrollbar, and the row list container. And then you have your row container that you add to the row list. There are multiple ways of doing this but this is the way I approached this. Sadly, I had a training video on how to do this but it’s obsolete after API2 and I’m not redoing them.

This approach really isn’t a ‘grid’ but with a little more work I think you could make resizable ‘columns’ and add other fun stuff to it. Again, highly recommend doing this in a small project to get the hang of it.

In my opinion, container controls are one of the most powerful controls in Xojo. It’s an easy way to make ‘dynamic’ views and specialized reusable controls. Say you’ve got email entries in multiple spots in your app you can create an ‘email’ container that has the label, textfield, and more importantly the email input verification code in the container. Then it’s a simple matter of adding the container wherever you have email input.

4 Likes

I’ll add one caveat to my container list: don’t try to load a million rows. It will definitely be super slow and no one will be happy with it. If that’s what you need then implement paging so the number of rows is limited to say a few hundred at a time. Since you control all of it with your container this is not a huge deal.

The big plus is you control all of it. The big minus is that you control all of it. :slight_smile:

2 Likes