Trouble wirth expandable listbox

I am trying to learn how to use expandable listboxes. I haven’t found an example that works. Specifically, the example in the docs for DesktopListbox.AddExpandableRow just doesn’t work on my Windows machine. In the listbox.Opening, I set AllowExpandableRows = True then copied the example code below it and ran it. It does nothing. The window does not even open.

What should a non-opening window have to do with a hierarchical listbox?

Have you seen:
Examples - Platforms - Desktop - ListBox - ListBox Basics?

This is a new example, added less than two weeks ago (when I downloaded the examples zip.)

But… probably a name change (or a modified example)… as its looks reminds me something I already see some weeks ago…

An application that shows what example do is missing…

Edit: I was wrong (more or less). Another Example.zip archive is available here:
https://documentation.xojo.com/versions/2023r1.1/_examples/xojoexamples.zip

and it does not have that example too, but … have it under its previous name (ListBox.xojo_binary_project)

You could set that property in the IDE for that DesktopListbox, then you wouldn’t have to set it in code.

To make a row expand, you set its RowExpandedAt property to True. You then also have to implement the RowExpanded event handler.

To which window do you refer? And can we see some code?

In Xojo2019r3.1: Examples - Desktop - Controls - Listbox - ListBoxExample.xojo_binary_project

And in 2023r1.1:

Examples → Platforms → Desktop → Listbox → Listbox Basics

I shared the link above…

I saw the ListboxBasics example earlier, but didn’ t take a good look at it because it didn’t run. I was able to make it run by eliminating the AlternateHighlightCheckbox and the PaintCellBackground events. Apparently alternate highlightling is not available in Windows.

The SourceList example also doesn’t run on Windows. It has a RowExpanded event in it so I think it is hierachal, but nothing happens when I run it.

I filed bug reports for both.

Which IDE version are you using? If hierarchical Listboxes don’t work on Windows, I’d be in trouble because the Tools page in Lifeboat uses one. (I haven’t had any reports of problems)

Update: I’ve just tested with 2022r2 and the example project is working here, so phew!

Still curious what IDE version you’re using, it may be broken in a newer one.

I’m using using 2023r1.1. Here is the code that causes the problem. It in AlternateHighlightCheckbox:

#If TargetWin32 Then
For row As Integer = 0 To StandardListBox.LastRowIndex
For col As Integer = 0 To StandardListBox.LastColumnIndex
StandardListBox.InvalidateCell(row, col)
Next

For row As Integer = 0 To HierarchicalListBox.LastRowIndex
For col As Integer = 0 To HierarchicalListBox.LastColumnIndex
HierarchicalListBox.InvalidateCell(row, col)
Next

#Else
// Redraw ListBox so that background are painted using the current value of the CheckBox
StandardListBox.Refresh(False)
HierarchicalListBox.Refresh(False)
#Endif

Here is the error message:

MainWindow.AlternateHighlightCheckBox.ValueChanged, line 4
Type “DesktopListBox” has no member named “InvalidateCell”
StandardListBox.InvalidateCell(row, col)

Oh… that. Sascha filed a ticket for that: #72906 - Examples: Platform - Desktop - ListBox - ListBox Basics: Using InvalidateCell

<big chunk of sassy disappointment in the Xojo staff that would get me banned by upsetting a certain moderator personally, even though each claim is totally valid and something Xojo actually did>

Change those to RefreshCell.

1 Like