PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

New WINDEV, WEBDEV, WINDEV Mobile 23 feature!
  • Overview
  • Initializing a List Box control
  • Initializing an element
  • Filling a List Box control
  • Selecting an element in a List Box control
  • Positioning on the element
  • Retrieving the element selected in a List Box control
  • 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 element selected in the list box.
The following notation allows you to handle an element found in a list box:
<Name of List Box> [<Element Subscript>]
Note: Several WLanguage functions are specifically used to manage the List Box controls. See the functions for managing list boxes for more details.
Initializing a List Box control

Initializing an element

To initialize an element found in a List Box control, use <List box>.Add.
Note: To modify an element found in a List Box control, use the following syntax:
<List Name>[Subscript] = <Value>
For example:
// Add elements
LIST_LIST1.Add("MOORE")
LIST_LIST1.Add(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>
<List Name>.Add(<Value>)
END
Example:
i is int
FOR i = 1 TO 52
LIST_LIST1.Add(NAME[i])
END
Selecting an element in a List Box control
  • the direct assignment:
    <List Name> = Subscript
  • <List box>.SelectPlus:
    <List Name>.SelectPlus(<Subscript>)

Positioning on the element

To position on the last element of List Box control, use:
Retrieving the element selected in a List Box control
  • the direct reading of element:
    Subscript = <List Name>
  • <List box>.Select:
    Subscript = <List Name>.Select()
Note: For the multi-selection List Box controls, <List box>.Select is used to retrieve the selected elements.
// Retrieve the elements from a multi-selection list box
Rank is int = 0  // selection number
Subscript is int = 0  // subscript of selected element
LOOP
Rank = Rank + 1
Subscript = LIST_LIST1.Select(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 = <List Name>
    <Variable> = <List Name>[Subscript]
  • Syntax 2:
    <Variable> = <List Name>[<List Name>]
  • Syntax 3: ..DisplayedValue (in server code only)
    <Variable> = <List Name>[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.
OccurrenceUsed 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 boxes 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 boxes 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 required version
  • Version 23
This page is also available for…
Comments
Click [Add] to post a comment