Idiot ? Who’s the idiot (ListBox)

Both of us: my and Xojo !

I wasted my whole morning with:

Var Cell_Text As String = Me.CellTextAt(6)

that gave not the correct answer.

All of a sudden, a suspicion comes to my mind and I add Row, to the line:

Var Cell_Text As String = Me.CellTextAt(Row,6)

All of this because of my failing memory and Xojo who says nothing, compile and execute the code as is without crash.

Three hours of battle against the wind !

Time to eat.

Leon is laughting in his tomb !

2 Likes
DesktopListBox.CellTextAt(row As Integer, column As Integer = 0 ) As String

When you pass just one number, that number is the row and it assumes column 0.

Safety wise I think it is not a great option, I presume a large enough number of people use many one column only lists and they provided that lazy way to address that.

real OOP would be:
Var Cell_Text As String = Me.Row(row).Column(6)

Not a good choice, very high cost for an operation that probably may be repeated 1000’s times.

1 Like

it does not matter, this is the idea of OOP.

it could be Me.Rows(0,1000)

and each cell could be any object.

No. No one designed something with the intention of being sluggish. Auxiliary functions can provide designs alike what you said IF such kind of selection is proven useful. But fast IO in matrices is a must.

to fasten things it could exists a method additionally Me.RowColumn(row,6)

i am unhappy that all cells are string content and can not be any other UI control or user class that can visualize itself.

however its Xojo

They can carry a variant too.

You have the RowTag.

OT
How long since? (that was a feature request)
i know that the cell tag can be used.
but row add had only strings as argument, i remember.

as workaround, sure

I don’t remember. As you probably know, it is a more than 1 step procedure.

list.AddRow
list.CellTextAt(list.LastAddedRowIndex, 0) = "USD 123.46"
list.CellTagAt(list.LastAddedRowIndex, 0) = 123.46  // a double

I probably do most listbox work via the tags.

2 Likes

Then create the visible content via the paint event. That way the listbox does the least work necessary as the paint event only fires for visible rows.

1 Like

OT
i used the Tag also.
my feature request was
AddRow ParamArray Item As Variant
instead of
AddRow ParamArray Item As String

alternate the suggestion to paint the .Tag object self and let the String part Empty is valid but not easy to implement. there are many things to consider.