KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Benefits of using the SET LIST ITEM ICON command
PRODUCT: 4D Developer | VERSION: 11 | PLATFORM: Mac & Win
Published On: November 6, 2007

In previous versions of 4D, the command SET LIST ITEM PROPERTIES allowed hierarchical lists items to display icons. In version 11, the SET LIST ITEM ICON command was introduced which provides benefits over the previous command to set icons to a list item. Below are the benefits:

1. No need to call GET LIST ITEM PROPERTIES to maintain previous attributes of the hierarchical lists. The SET LIST ITEM PROPERTIES command sets multiple properties each time it executes. Therefore, in order to change one property of a list item, all of the properties for that item will need to be fetched first with the GET LIST ITEM PROPERTIES. In version 11, SET LIST ITEM ICON only modifies the icon and nothing else.

2. The SET LIST ITEM ICON command accepts picture variables. In contrast, the SET LIST ITEM PROPERTIES command accepts static picture references such as 'cicn' or PICT resource as well as a picture reference from the picture library. Allowing the use of picture variables lessens the amount of code needed to use a picture not currently accessible in the resources or picture library.

3. The use of 4D picture expressions (field, variable, pointer, etc.) with SET LIST ITEM ICON will save memory when using the same picture for multiple items. This is possible with the use of pointers. For instance, the following code will display the same picture for two items, but only one instance of the picture will be loaded into memory:

C_PICTURE(vIcon)
SET LIST ITEM ICON(hlist;ref1;->vIcon)
SET LIST ITEM ICON(hlist;ref2;->vIcon)