The invisible column is an extra column thingy added behind the scenes to manage leftover column space. The problem is this extra column is not completely inaccessible, and doesn’t update properly when resizing columns.
This example creates a 2 column listbox, thin columns so there’s plenty of empty space on the right. With 2 columns the only EditCells you should be able to do on the first row are me.EditCell(0, 0) and me.EditCell(0, 1). But there is a 3rd ‘invisible’ column to manage that extra space and me.EditCell(0, 2) brings up the ActiveCell there. You don’t get an OutOfBounds until me.EditCell(0, 3).
Also, there’s no OOB in setting the text of this invisible cell, me.Cell(0, 2) = “foo”. foo won’t be drawn in the listbox but does appear when me.EditCell(0,2).
Then if you resize the columns thinner you’ll see the painted red regions width isn’t updated, leaving an unpaintable white region. Resizing the Listbox will update the extra column.
So the bug is that me.EditCell(0, 2) doesn’t trigger an OOB, and that the width isn’t updated during column resizing.
Actually, looking at the docs now after the fact I don’t see mention of OOB values so it’s sorta undefined what they should be. Maybe the OOB behavior is intentional.
//Listbox1, locked on all sides
Sub Open()
me.ColumnCount = 2
me.ColumnWidths = "100,100"
me.ColumnsResizable = true
me.HasHeading = true
me.AddRow "a", "b", "inv"
me.AddRow "c", "d", "isi"
me.AddRow "e", "f", "ble", "xx"
End Sub
Function CellBackgroundPaint(g As Graphics, row As Integer, column As Integer) As Boolean
if row < me.ListCount then //real rows...
if column < me.ColumnCount then
g.ForeColor = &c80FF80 //green for real cells
else
g.ForeColor = &cFF8080 //red for 'invisible' cells
end
else
if column < me.ColumnCount then
g.ForeColor = &c8080FF //blue
else
g.ForeColor = &c808080 //grey
end
end
g.FillRect(0, 0, g.Width, g.Height)
g.ForeColor = &c000000 //border
g.DrawRect 0, 0, g.Width, g.Height
End Function
Function CellClick(row as Integer, column as Integer, x as Integer, y as Integer) As Boolean
me.EditCell(row, column)
End Function
Function CellKeyDown(row as Integer, column as Integer, key as String) As Boolean
if key = Chr(13) then
me.EditCell(row, column + 1)
return true
else
return false
end
End Function