Listbox.ColumnAlignment(-1)

The line of code below compiles, but crash at run time:

LB.ColumnAlignment(-1) = Listbox.AlignCenter

Work-around:

LB.ColumnAlignment(0) = Listbox.AlignCenter LB.ColumnAlignment(1) = Listbox.AlignCenter LB.ColumnAlignment(2) = Listbox.AlignCenter LB.ColumnAlignment(3) = Listbox.AlignCenter LB.ColumnAlignment(4) = Listbox.AlignCenter LB.ColumnAlignment(5) = Listbox.AlignCenter LB.ColumnAlignment(6) = Listbox.AlignCenter

El Capitan / Xojo 2019r3.
Not tested on other platforms.

I was too lazy… but wasn’t it -1 function ?

LB.ColumnAlignment(-1) throws an OOB exception on 2019r1.1.

The way I understand the documentation you must specify an existing column so -1 is out of bounds.

[quote=474006:@Emile Schwarz]The line of code below compiles, but crash at run time:

LB.ColumnAlignment(-1) = Listbox.AlignCenter

[/quote]

What are you expecting that code to do ?

Assign the same alignment to all columns. Some other listbox methods do work in a similar way.

-Karen

ColumnAlignmentAt is listed as a property, not a method. Perhaps that makes the difference.

Whatever the docs call it, it is really a method under the hood… The only thing that takes an index that is not really a"method" is an array.

-Karen

unlikely
you cant actually pass parameters to properties - not even computed ones
its more likely a pair of get / set methods that are listed as a property

that some work with -1 as a param and others dont seems a curious inconsistency
I’d report it