Retrieving values from a listboxΒΆ

listbox_get_value()

Get values from a listbox


SYNTAX

listbox_get_value(listbox_id, valuefield_id, line)

Retrieves one or more values from a listbox.

The 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. Unused elements of the array are cleared.

The line to be stored is specified by line. If valuefield_id is an array field, then line may be set to zero to request that the array be filled with all values. Line numbers start from 1.

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


EXAMPLE

Returns the number of the line in a listbox that matches the supplied value:

!function GetListLine(ListBox, Value) {
!temp Loop,,u2
!temp Line,,u2
!temp ValueField,,a30
!temp MaxLine,,i2

     Loop = 1
     Line = 0
     if (Value = "") then goto GLL_RETURN
     MaxLine = listbox_count_all(ListBox)

     while (TRUE) {
          listbox_get_value(ListBox, ValueField, Loop)

          if (ValueField = Value) {
               Line = Loop
               break
          }
          if (Loop >= MaxLine) then break
          Loop ++
     }

GLL_RETURN:
     return Line
}

RELATED TOPICS

Listboxes

Tables

Listbox and table functions