4D v14.3

SELECT LIST ITEMS BY REFERENCE

Home

 
4D v14.3
SELECT LIST ITEMS BY REFERENCE

SELECT LIST ITEMS BY REFERENCE 


 

SELECT LIST ITEMS BY REFERENCE ( list ; itemRef {; refArray} ) 
Parameter Type   Description
list  ListRef in List reference number
itemRef  Longint in Item reference number or 0 for the last item added to the list
refArray  Longint array in Array of item reference numbers

The SELECT LIST ITEMS BY REFERENCE command selects the item(s) whose item reference number is passed in itemRef and, optionally, in refArray, within the list whose reference number is passed in list.

If there is no item with the item reference number you passed, the command does nothing.

If an item is not currently visible (i.e., it is located in a collapsed sublist), the command expands the required sublist(s) so that it becomes visible.

If you do not pass the refArray parameter, the itemRef parameter represents the reference of the item to be selected. If the item number does not correspond to an item in the list, the command does nothing. You can also pass the value 0 in this parameter in order to designate the last item added to the list.

The optional refArray parameter lets you select several items simultaneously within the list. In refArray, you must pass an array where each line indicates the fixed reference of an item to be selected.

In this case, the item designated by the itemRef parameter sets the new current item of the list among the resulting selection. It may or may not belong to the set of items defined by the array. The current item is, more particularly, the one that is edited if the EDIT ITEM command is used.

Note: In order for several items to be selected simultaneously in a hierarchical list (manually or by programming), the multiSelections property must have been enabled for this list. This property is set using the SET LIST PROPERTIES command.

If you work with item reference numbers, be sure to build a list in which the items have unique reference numbers; otherwise you will not be able to distinguish them. For more information, see the description of the APPEND TO LIST command.

Example  

hList is a list whose items have unique reference numbers. The following object method for a button selects the parent item (if any) of the currently selected item:

 $vlItemPos:=Selected list items(hList) ` Get position of selected item
 GET LIST ITEM(hList;$vlItemPos;$vlItemRef;$vsItemText)
  ` Get item ref number of selected item
 $vlParentItemRef:=List item parent(hList;$vlItemRef)
  ` Get item ref. number of parent item (if any)
 If($vlParentItemRef>0)
    SELECT LIST ITEM BY REFERENCE(hList;List item parent(hList;$vlItemRef)) ` Select the parent item
 End if

 
PROPERTIES 

Product: 4D
Theme: Hierarchical Lists
Number: 630

 
HISTORY 

Modified: 4D 2004

 
SEE ALSO 

EDIT ITEM
SELECT LIST ITEMS BY POSITION
Selected list items

 
ARTICLE USAGE

4D Language Reference ( 4D v12.4)
4D Language Reference ( 4D v11 SQL Release 6)
4D Language Reference ( 4D v14 R3)
4D Language Reference ( 4D v14 R2)
4D Language Reference ( 4D v13.5)
4D Language Reference ( 4D v14.3)
4D Language Reference ( 4D v14 R4)