How to determine whether listbox item is selected on shift-click
tony
For a listbox without a selection wave (mode=1), by shift-clicking a user can select or deselect a listbox item. In both cases the listbox action procedure receives a selection event and the row number for the clicked cell, but how should I tell whether an item is selected? Calling controlInfo within the listbox action procedure doesn't help because the selection is not yet updated. I can think of ugly workarounds, but it seems that there should be a straightforward way to tell whether the cell is being selected or deselected. To me it makes more sense that the row should be set to -1 for a deselection event.
That isn't particularly useful for mode=1, is it? Maybe I'll look into fixing that for Igor 9, but I think it's been that way for a long time and might break someone's code to change it.
And there is a work-around: use the mouse-up event (eventCode 2); at that point you can use ControlInfo to get the selection.
ControlInfo/W=$(lba.win) $(lba.ctrlName)
print "V_value (row selected) =", V_Value
break
This does what you want- it prints -1 if there is no selection.
April 13, 2020 at 11:54 am - Permalink
That works for me - thanks!
April 14, 2020 at 07:01 am - Permalink