Selected list items

4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next

version 2004 (Modified)


Selected list items (list{; itemsArray{; *}}) Longint

ParameterTypeDescription
listListRefList reference number
itemsArrayLongint arrayIf * omitted: Array contains the positions
of selected items in the expanded list(s)
If * passed: Array contains the selected
item references
**If omitted: Item position(s)
If passed: Item reference(s)
Function resultLongintIf * omitted: Position of current selected
list item in expanded list(s)
If * passed: Reference of the selected item

Description

The Selected list items command returns the position or reference of the selected item in the list whose reference number you pass in list. In the case of multiple selection, the command can also return in the itemsArray array, the position or reference of each item selected. You apply this command to a list displayed in a form to detect which item(s) the user has selected.

The * parameter lets you indicate whether you want to work with current item positions (in this case, the * parameter should be omitted) or with fixed item references (in this case, the * parameter must be used).

You can pass a longint array in the itemsArray parameter. If necessary, the array will be created and resized by the command. Once the command has been executed, itemsArray will contain:

the position of each item selected in the expanded list(s) if the * parameter is omitted.

the fixed reference of each item selected if the * parameter is passed.

If no items have been selected, the array is returned empty.

Note: In the event of multiple selections, the command returns the position or reference of the current item of list. The current item is the last item clicked by the user (manual selections) or the item set by the SELECT LIST ITEMS BY POSITION or SELECT LIST ITEMS BY REFERENCE commands (programmed selection).

If the list has sublists, you apply the command to the main list (the one actually defined in the form), not one of its sublists. The positions are expressed relative to the top item of the main list, using the current expanded/collapsed state of the list and its sublist.

In any case, if no items are selected, the function returns 0.

Examples

Here a list named hList, shown in User environment:


   $vlItemPos:=Selected list items(hList) ` at this point $vlItemPos gets 2




   $vlItemPos:=Selected list items(hList) ` at this point $vlItemPos gets 4
   $vlItemRef:=Selected list items(hList;*) ` $vlItemRef gets 200 (for instance)


   $vlItemPos:=Selected list items(hList) ` at this point $vlItemPos gets 8
   $vlItemRef:=Selected list items(hList;*) ` $vlItemRef gets 203 (for instance)



   $vlItemPos:=Selected list items(hList;$arrPos) ` at this point, $vlItemPos gets 3
      ` $arrPos{1} gets 3, $arrPos{2} gets 4 and $arrPos{3} gets 5




   $vlItemRef:=Selected list items(hList;$arrRefs;*) ` $vlItemRef gets 203 (for instance)
      ` $arrRefs{1} gets 101, $arrRefs{2} gets 203 (for instance)

See Also

SELECT LIST ITEMS BY POSITION, SELECT LIST ITEMS BY REFERENCE.


4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next