chickadee » bb » bb:add!

bb:add! WIDGET ITEM #!optional CALLBACK SHORTCUTprocedure
bb:add! LISTWIDGET TEXT #!optional POSITIONprocedure
(bb:add! TABLEWIDGET [CELLTEXT ...])procedure
bb:add! TEXTEDITOR TEXT #!optional REPLACEprocedure

If WIDGET is a menu-bar, choice-button or menu-button, bb:add! adds a new menu with the text ITEM (a string), the keyboard-shortcut SHORTCUT (another string) and the callback CALLBACK (a procedure of no arguments).

The string encoding the menu-item can include subitems, using the syntax foo/bar/baz. As many levels as necessary are created.

The shortcut can be #f or a string describing the shortcut in one of two ways: [#+^]ASCII or [#+^]CHAR where a decimal value represents an ascii character (eg. 97 is the ascii for 'a'), and the optional prefixes enhance the value that follows. Multiple prefixes must appear in the above order.


If WIDGET is an edit, entry or text-edit widget, ITEM should be a string, which will be added to the end of the existing text. In case of a text-editor, the optional boolean argument REPLACE indicates whether the text should be inserted, or the current selection be replaced.

If WIDGET is a list, the ITEM should be a string, which will added to the list of existing lines. The string may be prefixed by a @... sequence to enable special formatting:

Print rest of line, don't look for more '@' signs
Print rest of line starting with '@'
Use a large (24 point) font
Use a medium large (18 point) font
Use a small (11 point) font
Use a bold font
Use an italic font
@f or @t
Use a fixed-pitch font
Center the line horizontally
Right-justify the text
@B0, @B1, ... @B255
Fill the backgound with indexed color
@C0, @C1, ... @C255
Use indexed color to draw the text
@F0, @F1, ...
Use indexed font to draw the text
@S1, @S2, ...
Use point size n to draw the text
@u or @_
Underline the text.
draw an engraved line through the middle.

If WIDGET is a widget of any other type, then ITEM should be a child widget, which will be added with WIDGET as its parent.

For tree widget TEXT can be either full path (items are separated with slash) or text label. If it is terminated with slash, the branch (rather than leaf) will be inserted. One can specify parent node id and position in it (default values are -1 for both). The SUBWIDGET is a widget that will be inserted as a node. The procedure returns either the unique id of the freshly inserted node or -1 if failed.

This procedure can be used to add either columns (if first CELLTEXT is symbol column) or cells to the table widget.