I am trying to use ListBox.ColumnTypeAt to set a cell type but using the example from the documentation gives me ‘Type “Listbox” has no member named “CellTypes”’.

This is the code in question, “listBox” is a ListBox:

listBox.ColumnTypeAt(0) = ListBox.CellTypes.TextField

I added the row to make the ListBox had at least one row (in case that makes difference). I get the above error and I get the same result when I use .CellTypeAt(0,0).

I can assign a ColumnType of another column:

listBox.ColumnTypeAt(0) = listBox.ColumnTypeAt(1)

But I cannot add a number (instead of the enum CellTypes):

listBox.ColumnTypeAt(0) = 3

This gives me the error ‘There is more than one method with this name but this does not match any of the available signatures.’

How can I change the cell type of a cell (or ideally the cell types of an entire column)? What am I doing wrong?

I am using XOJO 2021 Release 1.1

Figured it out… XOJO does not differentiate between “ListBox” and “listBox” and hence confused the type and the instance and chose whichever one was least convenient for the task. I renamed listBox listBox1 and it worked.

Yeah, don’t do that.

I usually shorten the instance to lb as ListBox for simple cases like testing or inside methods with lb being passed into the method, and named ones like lbNames, lbAdresses, etc if I have more involved cases.

Some like to use list as ListBox but I find that confusing as for me a list is more like an array …

var was added to make Xojo less confusing to people coming from other languages, like javascript, but those langs are case sensitive where Xojo isn’t.

In those

var listbox as Listbox 

would be perfectly fine - but not in Xojo.

Seems the change to reduce “confusion” resulted in an expectation (of case sensitivity) that caused confusion … :roll_eyes:

1 Like