Another Approach to Specifying Multiple Images in a List Box

Description

Other examples have specified an image list with the I=imagelist command, and then selected the image to use by number. Another approach embeds the image name for each row in the data to be displayed by the list box.

Consider the following example.

dim filelist[100] as C
data = <<%dlg%
customer.$a5_table
invoice_header.$a5_table
invoice_items.$a5_table
products.$a5_table
invoices.$a5_set
%dlg%
filelist.initialize(data)
filelist.sort()
result = ui_dlg_box("Select Table/Set",<<%dlg%
{region}
[%O={I=:$(.)+1} {@1,$(.)-1}%.25,10filename^#filelist]|
{endregion};
<10OK> <10Cancel>
%dlg%)

In this case, each element in the input array contains the name of the image to associate with that row. Therefore it is not necessary to specify an image list, as we did in the previous example. The first component of the owner-draw string becomes:

{I=:$(.)+1}

The ':' tells Alpha Anywhere that the image is specified by name, rather than by number (as was the case in the previous example). The sub-command '$(.)+1' extracts the image name from the input value. In the case of the first entry, the image name is '$a5?_table'.

The sub-command, '$($)' would have worked equally well.)

Limitations

Desktop applications only.

See Also