Added March 2013; see History
XTREE's item icons are similar to the existing cell images (cformat type I ) except:
• | Item Icons are associated with items (one per item) rather than cells. |
• | Item Icons are always displayed at left edge of the item row. |
• | For multi-level trees, you can define a set of three item icons (in the 'zero column') corresponding to the three types of multi-level items (expandable, expanded, and leaf). In this case the icon will automatically change when an expandable item is toggled between expanded and collapsed. |
• | To specify individual icons for specific rows (rather then use just the expandable/expanded/leaf icons), you create a column using the new cformat code i to hold the icon spec. Unlike the I image column, which can contain both an image spec and display text, the i column only contains the image spec. Also, unless you want to display the image spec as text, the i column should be hidden, i.e. iH. |
Note that despite the terminology difference (icons versus images), you can use either type of image in either case (i.e. discrete image files, including .ico files, and icons embedded in a DLL, e.g. folder::ashico1). We use the term "icons" here to clarify that these images are meant to act like icons (i.e. be small, fixed in size, and symbolize some attribute of the item).
To activate item icons, specify the new flag XTF2_ITEMICONS in the flags2 parameter. By default, XTREE will use the following images for the icons:
%MIAME%\icons\FldCls_16.png (16x16 closed folder)
%MIAME%\icons\FldOpn_16.png (16x16 open folder)
<internal blank icon> (no icon for the leaf items)
You can override the choice of icons by specifying an advanced coldef option containing image specifications (any A-Shell supported type) for the three types of multi-level items:
ItemIcons=closed-img,opened-img{,leaf-img}
Note that if the tree is not multi-level, all of the items are considered leaf items and thus would receive the icon corresponding to the leaf items; the icon specified for expandable and expanded items would be ignored.
Three additional new Advanced Coldef Options may also be associated with ItemIcons:
ItemIconDir=<default image directory>
ItemIconSiz=iwidth,iheight,bpp
ItemIconCount=<# icons to load>,<grow-by-value>
These are analogous to the ImgDir, ImgSiz and ImgCount options associated with "I" image columns, except here they are all optional.
The default for the ItemIconSiz option is 16,16,24 (i.e. 16x16 image size and 24 bpp).
The ItemIconCount option is only applicable when you are have an "i" column in order to specify individual item icons (beyond the three defined in the ItemIcons option).
A blank cell within an "i" column will default to using the icon for that type of item (defined explicitly or implicitly by the ItemIcons option). In order to override the default icon with a blank icon, you can use the special icon specification "#".
The sample program XTRA21 in EXLIB:[908,21] illustrates a number of variations of ItemIcons.
The standard distribution now includes FldCls_16.png, FldOpn_16.png and Leaf_16.png icons in the icons subdirectory.
History
2013 March, A-Shell 6.1.1340: Function and documentation added to A-Shell