Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
OpenDialog ALLOWMULTISELECT
#14
Hi Gintaras,
I am trying to get the 0-based index of all the selected items from a MULTISELECT LB.

I already know how to get the text of all the selected items out using:
Quote:Function LB_GetSelectedItems (universal)

;/
function hlb ARRAY(str)&a

;Gets text of selected items in a multiple-selection listbox.


int i n=SendMessage(hlb LB_GETSELCOUNT 0 0)
if(n=-1) ;;single-sel control
,a.redim(1)
,if(LB_SelectedItem(hlb a[0])<0) a.redim
else
,a.redim(n)
,if(n)
,,ARRAY(int) selitems.create(n)
,,SendMessage(hlb LB_GETSELITEMS n &selitems[0])
,,for(i 0 n) LB_GetItemText hlb selitems[i] a[i]

and I know how to get the 0-based index from a single-select listbox using LB_SelectedItem but not from a multiselect.

The LB_GetSelectedItems function seems to get them all out in one go via LB_GETSELITEMS so that i counter-variable doesn't refer to the original array index but the newly filled index of JUST the selected items.

Is there any way to extract an array of selected index positions rather than text?

Thanks!!!!, Stuart


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)