JavaScript Editor js editor     Web development 

Main Page

File: ...\Samples\Solution\Controls\Lists\Piclist.scx

This sample illustrates how you can enhance your list boxes by adding picture graphics beside the individual text items. In this sample, you can pick any database (.dbc) file, and the list box will show different images beside the names of tables, local views and remote views.

The following code from cmdDatabase.Click enumerates through a .dbc and selectively adds pictures to list items using the Picture property. The Picture property relies on an index setting to determine which list item to affect.

В Copy Code
FOR i = (m.nTblCount+1) TO thisform.lstDatabase.ListCount
IF DBGETPROP(ALLTRIM(thisform.lstDatabase.List[m.i]),; "view","sourcetype") = 1  
       *Local view
      thisform.lstDatabase.Picture[m.i] = m.cLViewBMP
      * Remote view
      thisform.lstDatabase.Picture[m.i] = m.cRViewBMP
You need to ensure that the images used are sized correctly to fit within the space of a single list box item, which differs with the FontSize of the list.

See Also

JavaScript Editor js editor     Web development