savIRC uses a set of Tk widgets that doesn't come with the core tcl/tk distribution, most of them contributed by other programmers (see Credits), here I'll explain briefly how to create and configure them.
GUI Management.
When a new window (channel, query, dcc) is created all the widgets names of the window are inserted as new elements of the "wid" array. In this way the "wid" array contains the names of all widgets, the name of the array element will be of this form:
windowName,widgetName
Where windowName is the name of the window that contains the widget and widgetName is the name of the widget: i.e. listbox, button, entry, text, Etc.
So for example the name of the text widget of a channel with window $w will be stored in the variable $wid($w,text) and to change the background color in your scripts you can global the wid array and use the following command:
$wid($w,text) config -background
Notebook Widget.
The syntax for the Notebook widget:
tabcontrol ?window? ?options?
This creates a notebook widget and returns its name. For instance, you can create the notebook called .nb like this:
set nb [tabcontrol .nb -width auto]
The options are defined as:
-width auto|pixels|percent%
This controls the width of the tab row. For auto, the tabs will have the individual size required to display the tab label. If a percentage value is specified, the tabs will cover that percent of the entire widget's width. If a plain pixel value is specified, the tabs will be drawn to cover exactly that amount of pixels. If you allow the user to select their own font, be aware that some fonts will be larger than others, and can result in cut-off text for the tab. You only need to use one of the three.
The associated commands are:
insert tab-name row ?args?
This creates a new tab. Tabs are identified by a tab-name which must be unique for the metawidget. Tabs are filled into the specified row from the left to the right. Any additional arguments are passed to tabconfigure.
delete tab-name
Deletes the specified tab.
tabconfigure tab-name option value ?option value ...?
This configures a tab. Each tab is actually a label, therefore all label options are accepted. In addition there are two special options: -window specifies the user widget to be displayed when the tab is active. -command specifies a script to be evaluated each time the tab is activated.
tabcget tab-name option
Returns an option value, from the Options Database in Tcl/Tk for a tab.
invoke
Activates a tab and shows its associated user widget.
get ?active|row?
If no arguments have been specified it will return all tab names. If active is specified it will return the active tab. If a valid row number is specified it will return the tabs in this row.
bind tab-name bind-arguments
Applies bind arguments directly to a tab.
Labeled Frame.
The syntax for the Labeled Frame:
LabelFrame:create window -text text -font font -ipadx n -ipady n -relief relief -bd n
-text ?text?
Sets the text to be displayed in the label.
-font ?relief?
Sets the font of the text displayed in the label.
-ipadx ?n?
Sets the internal x-padding, the default is in pixel units.
-ipady ?n?
Sets the internal y-padding, the default is in pixel units.
-relief ?relief?
Sets the relief of the frame border, defaults to "groove".
-bd ?n?
Sets the thickness of the frame border, defaults to 2.
Below is an example.
# .bncGUI represents the toplevel frame frame .bncGUI.1 set bConf [LabelFrame:create .bncGUI.1.bConf -text "Misc. Options"] frame $bConf.1
AutoScroll Bar.
So you've written a listbox, but this box could potentially hold more items than the listbox can hold without needing a scrollbar. And putting a scrollbar in it, before it is needed, is not good UI design. That is why there is an AutoScroll bar. Instead of using the Tcl command, scrollbar, you would use, xscrollbar in its place.
In your script you would do:
xscrollbar $box1.scrl -orient vertical -command "$box1.list yview" autoscroll $box1.scrl