The ListBox really needs some love

In almost every project I start in Xojo, I start various things with the ListBox, but inevitably I end up ripping it out later and replacing it with something else, it’s a real shame because the ListBox does a tremendous amount of things right, but the the first two issues cause it to be benched for many projects. So can we please show some love for the ListBox and sign on to these feedback reports, so we can get her patched up and back into the fast lane.

1. Variable row height: <https://xojo.com/issue/993>
The inability to have some rows larger than others is the #1 reason why I end up tossing this Xojo control, often in favor of a canvas substitute and often taking far more time to re-implement the features that I enjoy from the ListBox.

2. Transparent background: <https://xojo.com/issue/36389>
Under modern macOS versions, it’s common for a source list control to bleed through blurred and muted colors from behind a ListBox, my intention is to display this, but getting there would be a lot easier if the background of the listbox wasn’t a solid color, I know that you can paint over the white, but you can’t paint it away. So you have to once again use or write a custom control to replace it.

3. Non standard macOS scrolling: <https://xojo.com/issue/16134>
The long and the short of it is that always visible scrollbars are not standard on macOS (unless the user has explicitly specified them in the System Preferences). Yes there are tricks you can do to simulate a more modern approach, however I think at the very least the ListBox should use overlay scrollbars or even better to use a proper NSScrollView on macOS so that it feels like a list control from other toolkits.

4. Listbox stealing scrollWheel events: <https://xojo.com/issue/51127>
The long and short of it, the greedy listbox consumes all scrollwheel events over top of it, even though there’s nothing to scroll. While not a dealbreaker it’s an annoyance when trying to create dynamic interfaces.

Replace the Xojo listbox with TableView from the MBS plugins. It has the speed and all the Cocoa features that you want. Except the variable row height.

Have you looked at @Karen Atkocius listbox classes? http://www.katkosoft.com/Mergeable%20Listbox%20Page/MergeableCellListbox.html

[quote=369379:@Sam Rowlands]2. Transparent background: <https://xojo.com/issue/36389>
Under modern macOS versions, it’s common for a source list control to bleed through blurred and muted colors from behind a ListBox, my intention is to display this, but getting there would be a lot easier if the background of the listbox wasn’t a solid color, I know that you can paint over the white, but you can’t paint it away. So you have to once again use or write a custom control to replace it.[/quote]

Use ClearRect first. See Tips&Tricks in xDev 14.1

Function CellBackgroundPaint(g As Graphics, row As Integer, column As Integer) As Boolean g.ClearRect ( 0, 0, g.Width, g.Height ) return false End Function

[quote=369379:@Sam Rowlands]4. Listbox stealing scrollWheel events: Feedback Case #51127
The long and short of it, the greedy listbox consumes all scrollwheel events over top of it, even though there’s nothing to scroll. While not a dealbreaker it’s an annoyance when trying to create dynamic interfaces.[/quote]

-1
In windows this is normal behaviour and your suggestion is highly unwanted because changing this will cause other, maybe invisible (scrolled out of sight) objects to show unwanted values. So PLEASE don’t implement this.

Another one:

Set Rows alternate colors, columns with the same width and resize >, then < its width: you end up with a splendid white column at the rightmost part of the Listbox.

yes Sam
listbox need Big Love on DeskTop and Web.

Thanks Beatrix, while I’m developing on Mac, this project is intended to be x-plat, it’s part of the reason why I decided to use the ListBox in the first place. I guess I’ll just have to see.

Thanks Wayne, I did take a brief look and came up with 3 reasons not to go that route. However I may have to reconsider.

  1. The views that the listbox sits on are resizable, which would mean a lot of faffing around every time the user resizes the view.
  2. The contents are editable, however the edit field only shows up in one row.
  3. Each row (with I’m using right now) links to a record, while not difficult to make multiple rows utilize the same record, it does create more complication.

[quote=369385:@Markus Winter]Use ClearRect first. See Tips&Tricks in xDev 14.1

Function CellBackgroundPaint(g As Graphics, row As Integer, column As Integer) As Boolean
g.ClearRect ( 0, 0, g.Width, g.Height )
return false
End Function[/quote]
Markus, thanks & brilliant!

[quote=369390:@Andre Kuiper]-1
In windows this is normal behaviour and your suggestion is highly unwanted because changing this will cause other, maybe invisible (scrolled out of sight) objects to show unwanted values. So PLEASE don’t implement this.[/quote]
Andre, I am not sure I understand your concern here, almost very other control in the toolbox will forward on the events if it doesn’t need them.

Emile, I’ve not noticed this. Does it happen on the mac or Windows?

[quote=369396:@Alexis Colon Lugo]yes Sam
listbox need Big Love on DeskTop and Web.[/quote]
I can’t say about the Web as I don’t use that (although I do use to create headless apps that run on my server). Like I mentioned, there’s a lot of reasons as to why I barely use it, but now that I’d like to create a x-plat application, it makes sense to try to use it.

Both (or Thrice ?): all platform. I think there is a Feedback for that.

35336 - Listbox last column resize creates void on the right

Oh right, I see. I often don’t use more than one column, which is probably why I’ve never seen it.

Yes.

Just from a quick scroll through my tickets regarding list boxes:

<https://xojo.com/issue/43704>
ListBox Shift+End, Shift+Home incorrect behaviour

<https://xojo.com/issue/43705>
ListBox Shift+Down Arrow, Shift+Up Arrow incorrect behaviour

<https://xojo.com/issue/46521>
ListBox focus ring with no selection stays when control does not have focus on Windows

<https://xojo.com/issue/46694> (needs review)
ListBox vertical scrollbar not positioning correctly on resize

<https://xojo.com/issue/47810>
Listbox.HeaderHeight returns incorrect value

<https://xojo.com/issue/47811>
Listbox with no border causes focus issues

<https://xojo.com/issue/48908>
Listbox.change event fires repeatedly when required selection is true

Nothing about the lack of control over the appearance of the header row?

I create my own customer header row by adding another single row listbox to the top of the main listbox and then emulate the standard header events. That way, I can use the paint options to decorate the “header” as I need.

Exactly

There is my Custom Listbox header (and I believe there are one or two others) mentioned on this forum

There are already solutions for many if not all of the ListBox “issues”. But the ListBox really needs some love from Xojo Inc… :slight_smile:

Another UI issue is that the list scrolls by row, not pixel. This isn’t a big deal when the row height is small, but at larger sizes it affects scrolling precision and is quite distracting.

There is a reason for that… the listbox is NOT just for list display… remember that cells can be editable so having partial rows visible would be complicated… Ever notice that Excel scrolls by row and not by pixel? I’m sure it is for that reason…

Remember the Listbox is a jack of all trades… which means it is VERY flexible (and X-platform!), but it also means it needs to have some compromises.

  • Karen

Oh I hate people who do this… sorry sorry…

Just tried it in Excel 2016. Pixel…
You can click into ‘half a cell’ and select it.
Type one character and the whole row slides into full view.