ListBox

I am thinking of returning to RealBasic / Xojo and must admit for the moment that I am totally puzzled by my inability to solve the following problem;

If I have a list box containing several lines of preset text and the user touchs/clicks on a line if their choosing, I can’t figure out how to fetch the selected line.

I do have a list box, preset with multiple lines of text and when the user creates the mouse down event, the list index is always set to the last line selected rather the current line selected.

Would someone take pity on me and tell me what I am missing ?

LISTINDEX is the pointer to the currently selected row

so S=me.cell(me.listindex,0) would return the text in the first column of the currently selected row

but the EVENT you want is CELLCLICK not MOUSEDOWN…

in which case it would be

s=me.cell(row,column)

Since these are inside events of the listbox itself… ME is a valid reference

Many thanks Dave

You are welcome Dave :slight_smile:

Dave McKee this Webinar on Listbox was very good that Paul Lefebvre did a few weeks ago.

Xojo Listbox Webinar Link

HTH.