version 11
SET LIST ITEM ICON ({*; }list; itemRef | *; icon)
Parameter | Type | Description | |
* | * | If specified, list is an object name (string) | |
If omitted, list is a list reference number | |||
list | ListRef | String | List reference number (if * omitted) or | |
Name of list type object (if * passed) | |||
itemRef | * | Longint | * | Item reference number or | |
0 for the last item added to the list or | |||
* for the current item of the list | |||
icon | Picture | Icon to be associated with item |
Description
The SET LIST ITEM ICON command can be used to modify the icon associated with the item specified by the itemRef parameter of the list whose reference number or object name is passed in list.
Note: It is possible to modify the icon associated with an item using the SET LIST ITEM PROPERTIES command. However, SET LIST ITEM PROPERTIES only accepts static picture references (resource references or pictures from the picture library).
If you pass the first optional * parameter, you indicate that the list parameter is an object name (string) corresponding to a representation of the list in the form. If you do not pass this parameter, you indicate that the list parameter is a hierarchical list reference (ListRef). If you only use a single representation of the list or work with structural items (the second * is omitted), you can use either syntax. Conversely, if you use several representations of the same list and work with the current item (the second * is passed), the syntax based on the object name is required since each representation can have its own current item.
You can pass a reference number in itemRef. If this number does not correspond to an item in the list, the command does nothing. You can also pass 0 in itemRef to indicate the last item added to the list (using APPEND TO LIST).
Lastly, you can pass * in itemRef: in this case, the command will be applied to the current item of the list. If several items are selected manually, the current item is the last one that was selected. If no item is selected, the command does nothing.
Pass a valid 4D picture expression (field, variable, pointer, etc.) in the icon parameter. The picture will be placed to the left of the item.
The use of pointers is particularly recommended since hierarchical lists are optimized in this case: only one instance of the picture will be created in memory if the same icon is used for several different list items.
Note: Conversely, the direct use of variables generated by the GET ICON RESOURCE or GET PICTURE RESOURCE commands is not recommended because the icon will be duplicated in memory for each item of the list.
Example
This code has been optimized thanks to the use of a pointer:
vIcon:=[Params]Icon SET LIST ITEM ICON(mylist;ref1;vIcon->) SET LIST ITEM ICON(mylist;ref2;vIcon->)
See Also