KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to use a Picture Library picture for use as an Icon in a Hierarchical List
PRODUCT: 4D | VERSION: 2004.6r2 | PLATFORM: Mac & Win
Published On: July 25, 2007
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

Here is how you can reference a Picture Library picture to use as an icon procedurally in a custom Hierarchical List (hlist).

  1. 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:



  2. 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

  3. 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.