Xbasic

UI_GET_LIST_ARRAY Function

Syntax

Result_String as C = UI_GET_LIST_ARRAY(C title,N default_choice,C array_name)

Result_String as C = UI_GET_LIST_ARRAY( Title as C, Default_Choice as N, Array_Name as C [, Sizeable as L [, Xpos, Ypos [, Xsize, Ysize ]]] )

Arguments

title

The title of the dialog box.

default_choice

Determines which list box entry is selected when the dialog box first appears. This parameter is a numeric value indicating which item is to be selected (from 1 to the last element of the array). For example, if the Default_Choice is 5, the fifth list box entry is highlighted when the dialog box appears.

array_name

A character string containing the name of a defined array. You must declare this array as an array of character strings. For example, the following statement displays the contents of the Company array: ui_get_list_array("Choose a Company Name", 1, "Company").

Sizeable

Optional. Default = .F. Determines if the dialog can be resized by the user.

.T. = sizeable
.F. = not sizeable
Xpos and Ypos

Optional. Parameters that determine where on the screen the dialog is displayed. Both parameters must be between 0.0 and 1.0, where 0 represents the top (or left) corner of the screen, and 1 represents the bottom (or right) corner. Xpos and Ypos values of 0.5 and 0.5, for example, represent the center of the screen.

Xsize and Ysize

Optional. Parameters that determine the size of the dialog. Both parameters must be between 0.0 and 1.0, where 1 represents the full width or height of the screen. Xsize and Ysize values of 0.25 and 0.25, for example, represent a dialog that fills one quarter of the screen.

Description

UI_GET_LIST_ARRAY() displays a dialog box with a list box filled with the contents of a character array. Your response is returned as a Result_String that contains the contents of the listbox entry that you either double-clicked or highlighted before you clicked the dialog box's OK button. This function is useful for selecting a value from the contents of an array. The Result_String will be empty ("") if the Cancel button is selected. Prompt user for selection from list.

Example 

Populate an array with all the fields in the current table.

dim fields[1024] as C
tbl = table.current()
number_of_fields = tbl.fields_get()
for i = 1 TO number_of_fields
    fld = tbl.field_get(i)   'get a pointer to field I
    name = fld.name_get()   'get the name of this field
    fields[I] = name
next i

Let user select a field.

fld_name = ui_get_list_array("Choose a field", 1, "fields")

Limitations

Desktop applications only.

See Also