PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Overview
  • Initializing a List Box control
  • Initializing an element
  • Filling a List Box control
  • Selecting an element in a List Box control
  • Selecting a row
  • Positioning on the element
  • Retrieving the element selected in a List Box control
  • Retrieving the subscript of selected element
  • Retrieving the value of selected element
  • Properties specific to the management of List Box controls
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Overview
WINDEV, WEBDEV and WINDEV Mobile allow you to handle a List Box control by programming. To do so, use the variable of List Box control in the code. This variable is a numeric variable.
The variable of List Box control:
  • corresponds to the name of List Box control.
  • is initialized with the subscript of the element selected in the List control.
To handle an element of the List Box control, use the following notation:
<Name of List Box> [<Element subscript>]
Note: Several WLanguage functions are specifically used to manage the List Box controls. See functions for managing List Box controls for more details.
Initializing a List Box control

Initializing an element

To initialize an element found in a List Box control, use ListAdd.
Note: To modify an element found in a List Box control, use the following syntax:
<Name of List Box control>[Subscript] = <Value>
For example:
// Add elements
ListAdd(LIST_LIST1, "MOORE")
ListAdd(LIST_LIST1, Cust_Name)
// Modify elements
LIST_LIST1[3] = "MOORE"

Filling a List Box control

To initialize a List Box control, all you have to do is use an iteration loop to initialize all the elements of List Box control.
Subscript is int
FOR Subscript = <Start position> TO <End position>
ListAdd(<Name of List Box control>, <Value>)
END
Example:
i is int
FOR i = 1 TO 52
        ListAdd(LIST_LIST1, NAME[i])
END
Selecting an element in a List Box control

Selecting a row

To select the element found at <Subscript> row, use:
  • the direct assignment:
    <Name of List Box control> = Subscript
  • the function ListSelectPlus:
    ListSelectPlus(<Name of List Box control>, <Subscript>)

Positioning on the element

To position on the last element of List Box control, use:
  • ..Count:
    <Name of List Box control>..Count
  • ListSelectPlus associated with ..Count:
    ListSelectPlus(<Name of List Box control>, <Name of List Box control>..Count)
  • ListCount:
    ListCount(<Name of List Box control>)
Retrieving the element selected in a List Box control

Retrieving the subscript of selected element

To retrieve the subscript of selected element, use:
  • the direct reading of element:
    Subscript = <Name of List Box control>
  • ListSelect:
    Subscript = ListSelect(<Name of List Box control>)
Note: For multiselection List Box controls, ListSelect is used to retrieve the selected elements.
// Retrieve the elements of a multiselection List Box control
Rank is int = 0  // selection number
Subscript is int = 0  // subscript of selected element
LOOP
Rank = Rank + 1
Subscript = ListSelect(LIST_LIST1, Rank)
IF Subscript = - 1 THEN BREAK
END

Retrieving the value of selected element

To retrieve the value of selected element, use one of the following syntaxes:
  • Syntax 1:
    Subscript is int = <Name of List Box control>
    <Variable> = <Name of List Box control>[Subscript]
  • Syntax 2:
    <Variable> = <Name of List Box control>[<Name of List Box control>]
  • Syntax 3: ..DisplayedValue (in server code only)
    <Variable> = <Name of List Box control>[Subscript]..DisplayedValue
Caution: The value stored in programming can differ from the displayed value. To find out the stored value corresponding to one of the rows found in the List Box control, use ..StoredValue.
Properties specific to the management of List Box controls
The following properties are used to manage the List Box controls:
All types of List Box controls
HorizontalAlignmentUsed to find out and modify the horizontal alignment of the elements found in the List Box control.
LineHeightUsed to find out and modify the height of the rows in a List Box control.
MemoryUsed to find out whether the specified control is a memory or browsing List Box control.
CountUsed to find out the number of rows in a List Box control.
FillTypeUsed to find out the method (file, memory or variable) used to fill a Table, List Box, ListView, Combo Box or Looper control.
DisplayedValueUsed to find out the value of the current row or the value of a specific row in the List Box control.
StoredValueUsed to find out the value currently stored when selecting a row in the List Box control.
EmptyUsed to find out whether a List Box control is empty.
Memory List Box control only
InitialContentUsed to find out the initial content of a memory List Box control.
SortedUsed to find out whether a memory List Box control is sorted and to sort a memory List Box control.
Browsing List Box control only
BrowsedFileAllows you to find out and modify the data file or the query used to display records in the browsing List Box controls.
AutoBrowseUsed to find out whether a browse performed in a browsing List Box control is an automatic browse or a programmed browse.
DisplayedItemUsed to find out and modify the item displayed in a List Box control.
StoredItemUsed to find out and modify the stored item of a List Box control.
BrowsedItemAllows you to find out and modify the item used for the automatic browse of List Box controls.

To find out the entire list of WLanguage properties that can be used with a List Box control, see Properties associated with the List Box control.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment