| TreeListBox seems to be the correct choice, icons can be integrated as bitmap: ”C:\\mypath\\mybitmap.bmp” and bitmap2:”C:\\mypath\\mybitmap2.bmp” in case the bitmap should change, when selected. As every other file the bitmap can be stored in the database and received with bitmap: “db:\\mybitmap.bmp”.
Attached find a sample code snippet that includes the requirements, multiple selection can be caught and resolved afterwards in ADOscript. The sample introduces a tree box, allows multiple selections, has two colums, and uses own bitmaps to show the tree. Selections are caught by ADOscript to trigger the appropriate scripts.
# create the main TreeListBox with all its parameters CC "AdoScript" TLB_CREATE title:"My title" oktext:"Close" canceltext:"No way!" boxtext:"These are my entries" no-help:1 button-w:60 columns:2 multi-sel:99 max-w:500 max-h:367 min-w:200 min-h:150
# insert some entries (as you like - ID should be unique) CC "AdoScript" TLB_INSERT id:1 is-parent:1 text:"Root" CC "AdoScript" TLB_INSERT id:2 parentid:1 bitmap:"C:\\mypath\\first.bmp" bitmap2:"C:\\mypath\\second.bmp" text:"selection - 1 \t aaa
CC "AdoScript" TLB_INSERT id:4 parentid:2 bitmap:"C:\\mypath\\first.bmp" bitmap2:"C:\\mypath\\second.bmp" text:"selection - 3 \t bbb
CC "AdoScript" TLB_INSERT id:3 parentid:1 text:"selection - 2 \t aaa"
# select the first entry (here: check it) CC "AdoScript" TLB_SELECT id:1 select:1
# and finally show it CC "AdoScript" TLB_SHOW IF (ecode = 0) { CC "AdoScript" INFOBOX ("Selected ids: " + selectedids + "\n" + "You pushed the following button: " + endbutton) } ELSE { CC "AdoScript" INFOBOX ("You cancelled the dialog!") }
Extension to previous example using TLB_INSERT
CC "AdoScript" TLB_INSERT id:intValue text:strValue [ parentid:intValue] [ is-parent:boolValue] [ bitmap:strValue ] [ bitmap2:strValue ] . -->RESULT ecode:intValue .
id: unique identifier of the new entry text: text to be displayed parentid: The parameter specifies the parent entry of the new entry. This is how you create the tree-like structure. If you do not specify this parameter, the entry is inserted as a root entry. is-parent: to define if subentries or not as boolean 0: The new entry is a leaf (has no subentries). 1: The new entry is a parent (can be expanded). Parents are displayed with a folder icon () or defined bitmap
bitmap: Name of a graphics file. The graphics is used as icon for the new entry. All common bitmap file types are supported, e.g. png, gif, bmp. The dimensions of the bitmap should be 16x16 (pixels). With other dimensions the bitmap is stretched to 16x16 automatically.
bitmap2 : Name of a graphics file. The graphics is used as icon for the new entry when the entry is in expanded state.
ecode: Error codes 0: no error occurred 2: you have to call TLB_CREATE before calling this function 3: an argument is missing 4: you passed an invalid (already existing) ID |
|