Detect selected column in Listbox

How can I detect the selected column in a listbox? Can’t find anything adequate.


Check the docs for ListBox.ColumnFromXY there’s a project example under Desktop>Controls>ListboxExample.

Also good webinar was just done about a month ago on listboxes - Listbox Webinar Hopefully those get you in the right direction.

just add a variable to hold the value… set it in the CELLCLICK event

I can’t add a property to a control. And a global variable I don’t want to use. So what can I do?


you can try with a little function like this?..
I have not tested but it is an example …
you can pass the Listbox as an object

function SelectedItem( obj ) as long
dim x as long
for x as long = 0 to obj.ListCount
if obj.Selected(x)=True
return obj.ListCount
exit function
end if
return -1
end function

return -1 if no selected item
return the position of the first selected item (in single mode selection))
Vic53 from Rome

Create a subclass & add as many as you want

Can you elaborate a bit more on this?

If I’m in the CELLCLICK event handler, what do I specifically assign the variable to? I’m looking for the syntax.

Never mind…I’ve started a separate post for this.