SELECT LIST ITEMS BY POSITION

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)


SELECT LIST ITEMS BY POSITION (list; itemPos{; positionsArray})

ParameterTypeDescription
listListRefList reference number
itemPosNumberPosition of item in expanded list(s)
positionsArrayNumber arrayArray of the positions in the expanded list(s)

Description

The SELECT LIST ITEMS BY POSITION command selects the item(s) whose position is passed in itemPos and, optionally, in positionsArray within the list whose reference number is passed in list.

The position of items is alwaysexpressed using the current expanded/collapsed state of the list and its sublists. You pass a position value between 1 and the value returned by Count list items. If you pass a value outside this range, no item is selected.

If you do not pass the positionsArray parameter, the itemPos parameter represents the position of the item to be selected.

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

When you pass this parameter, the item designated by the itemPos 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.

Examples

Given the hierarchical list named hList, shown here in the User environment:

1. After the execution of this code:

   SELECT LIST ITEMS BY POSITION(hList;Count list items(hList))
   REDRAW LIST(hList) ` Do NOT forget to call REDRAW LIST otherwise the list won't be updated
The last visible list item is selected:

2. After execution of the following lines of code:

   SET LIST PROPERTIES(hList;0;0;18;0;1)
      `It is imperative to pass 1 as the last parameter in order to allow multiple selections
   ARRAY LONGINT($arr;3)
   $arr{1}:=2
   $arr{2}:=3
   $arr{3}:=5
   SELECT LIST ITEMS BY POSITION(hList;3;$arr)
      `The 3rd item is designated as the current item
   REDRAW LIST(hList)

... the 2nd, 3rd and 5th items of the hierarchical list are selected:

See Also

SELECT LIST ITEMS BY REFERENCE, 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