Listbox Vertical Scrollbar showing horizontal

I’ve seen a report on this years ago…Listbox Strangeness - Scrollbars but the gremlins seem to be back again.

When the vertical scrollbar is supposed to appear I get a fragment of a horizontal scrollbar instead - in red circle below. It animates as I scroll.
Screenshot 2024-09-19 at 2.45.17 PM

I’ve tried various resets, or changing the master class back and forth, but can’t seem to change it.

It’s a Mac screenshot, right?

Appears on conditions. Do you fullfil them ?
Check with the documentation, but no relative width must be used for columns (or they willl not appears); that means, no * nor % in the width values… and of course, the total width of all columns must be > than the window width !
Shrink your window to check.

Prerequisite: Have ListBox HorizontalScrollBox set to True.

Yes. MacOS 14.6.1, Xojo 2024 r1.1.

Sorry if I wasn’t clear. The problem is the vertical scrollbar not appearing, but instead it is showing a remnant of a horizontal scroll bar at the bottom right of the listbox.

Did you fired Disk Utilities ?

Also, by default, sincce some years, Scrollbar disappears when not used (if my memory is correct). Moving the cursor there make it reappear.
Check System Preferences to validate my (very bad) memory.

I’ve never ever seen a listbox behave like that. Do you have a listbox subclass? Have you tried NSTableviewMBS?

I have run Disk Utilities repair, I have restarted the mac, I have upgraded to Xojo 2024 r2.1. Still the same. I will try to isolate into a smaller app - but that always takes time.

It is just standard DesktopListbox - not subclassed. I’m using columnAttributes to set the columns up, but nothing special, all fixed width bar one with a “*”.

I’ve not tried NSTableView as listbox has always worked for me before.

What if you try a normal Listbox does the problem still occur?

1 Like

You mean a deprecated listbox rather than a desktopListbox. No, I haven’t, as many of the functions I use are desktopLIstbox functions - like columnAttributes.

ColumnAttributes is not exclusive to the Desktop-prefixed-framework, it was previously Listbox.Column(index) as ListColumn.

I do think it would be worthwhile to see if the Reliably-Tested-Listbox resolves your issue. I’d test it myself, but I can’t replicate the issue.

Although the available properties seem to be quite different in each.

Anyway, I seem to have tracked down the culprit, though I can’t say I can understand it.

I had a calculated property that was checking the listbox.height and if different to the sent value, was resetting the height to the value. I think this was used previously to stop the resize events occurring when setting the same height. For some reason, that I can’t track down as it is not called by anything, this was setting the listbox height to zero when the containerControl holding the listbox was constructed and embedded. Subsequent resetting to the correct height ended up with the strange horizontally mounted vertical scrollbar.

I’ve removed this property and now the listbox scrollbar is correct. I’ve tried to recreate the issue in a different project, but can’t get it to re-appear.