BB___SELECTINDEX

=SELECTINDEX= toc

Description
> Selects the item at index position //num// and updates the display.

Hints

 * //**Index Selection.**// The index numbers begin with "1" in a Listbox or Combobox control. Remember, index numbers might not match array numbers (an array can have an index "0" for instance), especially if array items have been deleted and the list has been reloaded.

Example
code format="lb" ' Using SELECTINDEX nomainwin a$(1) = "apple" a$(2) = "orange" a$(3) = "banana" a$(4) = "pear"

listbox #win.lst, a$, [getIndex], 10, 10, 120, 200

open "Select Index Demo" for window as #win #win "trapclose Quit"

' Use SELECTINDEX to highlight the default selection #win.lst "selectindex 2"

wait

sub Quit handle$ close #handle$ end end sub

[getIndex] #win.lst "selectionindex? indexNum" notice "You chose Index number ";indexNum wait code

Useful Functions
code format="lb" Place a useful function using this keyword here code