I guess that ListBox.Heading is not an actual array, but a method?
I don’t seem to be able to do
// Can't remember if I can initialize an array in Xojo like this, but you get the gist...
Dim myHeadings() As String = ("Col1", "Col2", "Col3")
myListBox.Heading = myHeadings
Or you could write your own extension that does this
Something like
Module ListBoxExtensions
Sub Heading(extends lb as listbox, assigns s() as string)
for i as integer = 0 to min(s.ubound, lb.columnCount - 1)
lb.heading(i) = s(i)
next
End Sub
Function Heading(extends lb as listbox) as String()
dim headings() as string
for i as integer = 0 to lb.columnCount - 1
headings.append lb.heading(i)
next
return headings
End Function
End Module
Dim myHeadings() As String = Array("Col1", "Col2", "Col3")
Listbox1.HasHeading = True //not needed if already set
Listbox1.ColumnCount = myHeadings.Ubound + 1 //not needed if already set
Listbox1.Heading(-1) = Join(myHeadings, Chr(9))