Here is how you can reference a Picture Library picture to use as an icon procedurally in a custom Hierarchical List (hlist).
- First you need the Picture ID for the picture to be added to the hlist. To get this number, in Design mode, navigate to the Tool Box:
When the Tool Box window appears, you can see that 4D assigns pictures Picture ID numbers. This number is written beneath each picture on the left:
Alternatively, you can double-click a picture for more information, including the Picture ID:
- In order to reference the picture programmatically, you need to pass a numeric value. This is how to calculate that value:
$icon := Use PicRef + <Picture ID> `where Use PicRef is based on 4D's constants for hierarchical lists.
For example, if your Picture ID from step 1 is 2078, your formula would be the following:
$icon := Use PicRef + 2078
- Now you can use SET LIST ITEM PROPERTIES, with "$icon" is the icon parameter, to set the Picture Library picture as an icon for the hlist..
This works on both Windows and MacOS systems, but Macs have a few more options for referencing pictures -- see the constants for hierarchical lists documentation for more information.