Skip to content

TLB_INSERT ​

Inserts a new item in the TreeListBox

Syntax ​

leo-grammar
CC "AdoScript" TLB_INSERT	id:intValue text:strValue
							[ parentid:intValue ] [ is-parent:boolValue ]
							[ bitmap:strValue ] [ bitmap2:strValue ]

  # --> RESULT ecode:intValue .
CC "AdoScript" TLB_INSERT	id:intValue text:strValue
							[ parentid:intValue ] [ is-parent:boolValue ]
							[ bitmap:strValue ] [ bitmap2:strValue ]

  # --> RESULT ecode:intValue .

Parameters ​

  • id (intValue) - unique identifier of the new entry
  • text (strValue) - text to be displayed
  • parentid (intValue, optional) - 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 (boolValue, optional) - 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.
  • bitmap (strValue, optional) - 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 (strValue, optional) - name of a graphics file. The graphics is used as icon for the new entry when the entry is in expanded state.

Returns ​

  • ecode (intValue) - as follows 0 = no error occured, 2 = you have to call TLB_CREATE before calling this function, 3 = an argument is missing, 4 = you passed an invalid ID

Details ​

If you have a multy column TLB (the parameter columns was specified at the command TLB_CREATE) you must separate the text for each column with a tab character ("\t").
> TLB_INSERT id:1 text:"Column 1\tColumn 2\tColumn 3"

See Also ​

TLB_ADD_BUTTON
TLB_CREATE
TLB_EXPAND
TLB_EXPAND_ALL
TLB_EXPAND_TO
TLB_REMOVE
TLB_SELECT
TLB_SELECT_ALL
TLB_SHOW

Examples ​

asc
# 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
        max-w:500 max-h:367 min-w:200 min-h:150 checklistbox:0

# insert some entries (as you like - ID should be unique)
CC "AdoScript" TLB_INSERT id:1 text:"Do this" is-parent:1 
CC "AdoScript" TLB_INSERT id:3 parentid:1 text:"here"  
CC "AdoScript" TLB_INSERT id:2 text:"Do that"

CC "AdoScript" TLB_EXPAND_ALL

# select the first entry (here: check it)
CC "AdoScript" TLB_SELECT id:3 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!")
}
# 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
        max-w:500 max-h:367 min-w:200 min-h:150 checklistbox:0

# insert some entries (as you like - ID should be unique)
CC "AdoScript" TLB_INSERT id:1 text:"Do this" is-parent:1 
CC "AdoScript" TLB_INSERT id:3 parentid:1 text:"here"  
CC "AdoScript" TLB_INSERT id:2 text:"Do that"

CC "AdoScript" TLB_EXPAND_ALL

# select the first entry (here: check it)
CC "AdoScript" TLB_SELECT id:3 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!")
}

Versions and Changes ​

Available since ADOxx 1.3