Retrieving selected values from a listboxΒΆ

listbox_get_selected()

Retrieve the selected values from a listbox


SYNTAX

listbox_get_selected(listbox_id, valuefield_id [, linefield_id])

Retrieves the currently selected value(s) from a listbox.

The selected values are stored in valuefield_id, which can be a simple field or an array field. The number of values that can be returned is limited by the dimension of the field. If a linefield_id is supplied, this receives the line numbers corresponding to the values stored in valuefield_id, and should have the same dimension. Unused elements of both arrays are cleared.

Unless the listbox is a multiple selection LIST_BOX type, only one value can ever be selected.

The function returns the number of values selected, which can be zero.


EXAMPLE

Retrieve the selected value from a listbox in its event function:

!temp FDLT,,a20

     +listbox LTList at 457,58 {
          listbox_type = LIST_BUTTON
          width = 60
          event = LTListEvent
      }

!function LTListEvent(EventCode, Object) {
     if (EventCode <> EV_SINGLE_CLICK) then return
     listbox_get_selected(LTList, FDLT)
     return
}

RELATED TOPICS

Listboxes

Listbox and table functions

Listbox types