Regression bug in 2017R2.1: Listbox crashes (confirmed, includes workaround)

All you need to do is add a ListBox to a Window, add a row, make a cell editable:

Sub Open() Handles Open me.AddRow "" Me.CellType(0, 1) = Listbox.TypeEditableTextField End Sub

Now activate the editable cell (and type something if you want), try to quit the app -> crash.

Tried on MacOS 10.12.6 with Xojo 2017R2.1

Problem does not show on Xojo 2017R1.1

Could someone please confirm before I file a bug report?

And found a workaround: on close shift the focus from the active cell to the ListBox itself.

Add this to the ListBox:

Sub Close() Handles Close if me.ActiveCell.Active then me.SetFocus End Sub

Submitted as <>

Does not crash here in 2017r1.1

Its happening in Windows 10 too

Thanks Christian & Sunil.

As a workaround what i have do is before closing the app. call listbox.close in the app close event

But if you have custom list boxes that you use in several projects then you must not forget to add that in the app.close event.

It is more object-orientated and less bound to cause problems if you keep the work-around with the affected control.

I get this same crash even in 2017r2.0 on Mac, and the fix that Markus suggested also fixes it in 2017r2.0

Are you sure that this is a bug?

Sub Open() Handles Open me.AddRow "" Me.CellType(0, 1) = Listbox.TypeEditableTextField End Sub
Me.AddRow “” adds only one cell in column 0. There is no content set for the cell in column 1, so you cannot access any property which starts with Cell… and has to do with the content, like Cell itself, CellTag, CellHelpTag, etc. And this is all independent of ColumnCount.

I tried with

me.addRow "", "", ""


me.AddRow "a", "b", "c"

as well. Same result.

Btw the ListBox is set as a three column ListBox, so addRow adds a row with three cells, and therefore the cell exists, independent of wether it contains data or not.

Funny. Seems I also discovered a forum bug? See above. Both lines have the code tag around them.

AddRow("") adds only one column – even if ColumnCount is set to 3.

Then I would expect an exception when clicking on column 1 (aka the second column) to edit the cell, but I don’t get one.

I also should not get a three column heading (with HasHeading enabled) if that were true, but I do (so why a column heading if the column doesn’t exist?)

The contents of the cells in column 1 and 2 might be Nil (and that might explain why they do not show up in the debugger), but they do exist.

I can of course be wrong (I often enough am), but the contortions necessary behind the scenes if you only add the column on request of a cell rather when the ListBox opens according to the settings seem strange.

I think it is more accurate to say it only populates one column. Each standard listbox row will contain all the columns, albeit some may be empty.

The first one has a space after the last ] which tells the forum that it’s an inline code tag.

Thanks. Learned something new :slight_smile: