Home

The Slab Library

Slab (Snit Library, Almost BWidget) is a port of most of BWidget to Snit. Unported parts are retained in their BWidget form.

The BWidget code is mature and well written, and has been retained wherever possible, with conversion of obsolete idioms to Tcl 8.5+.

Full Documentation

The following widgets, and all their dependencies, have been ported to Snit:

Although alternatives to some of these widgets have been added to Tk and Ttk in recent years, other BWidget/Slab widgets remain indispensable. The ScrollableFrame, ScrolledWindow, NoteBook, SelectColor, and MainFrame are particularly useful.

The following BWidget widget has been ported to Snit but (when unthemed) it retains a dependency on BWidget's ComboBox. The following BWidget widgets have not (yet) been converted to Snit: These BWidget widgets are retained in Slab, and have been made compatible with any dependencies that have been converted to Snit. BWidget's Widget "base class" is retained (as module Slab::Widget), and is loaded only if one of these unconverted widgets is loaded.

New Features

All widgets and other parts of Slab are provided as tcl::tm modules. Slab retains BWidget's "lazy loading" of commands, but uses a module-based mechanism rather than BWidget's tclPkgSetup interface to the Tcl autoloader. If required, the library can be confined to the ::Slab namespace and its children.

Internationalization uses locale modules based on msgcat that, like BWidget's option files, are loaded on demand.

Purpose

Slab was written for use by the Kerlin™ project. It is offered as a stand-alone library under the BWidget license, in the hope that others may find it useful.

It is open to anyone to convert some or all of Slab to TclOO to create an "official" class library for Tk. Megawidgets written in Tcl/Tk perform extremely well, and it is unnecessary for "official" megawidgets to be written in C. A significant advantage of Tcl/Tk megawidgets over those written in C is that a greater proportion of users are capable of contributing to development.

Configuration

By default, Slab is configured for maximum compatibility with code written for BWidget. See the Slab documentation for more information.

Differences from BWidget

  1. Whether a BWidget widget is themed or unthemed is determined when it is created. In Snit it is not possible to include or omit options at runtime (except by using another level of delegation), and so "themed" Slab widgets have a number of options that they should not have, which are given the value ==Not-Used-When-Themed== and are immutable.

  2. Slab tries to use theme colors when it operates in "themed" mode. However, this is imitation rather than true theming: if the user changes the theme, the colors of unthemed widgets do not change.

  3. BWidget's computation of default values for options has not been ported.

    BWidget defines default values for its widget options partly by copying from the values for Tk widgets. Hence modifications to the options database for Tk widgets will also apply to particular options of some BWidget widgets. This feature is benign and mostly useful, but it is not implemented in Slab. To achieve results identical to those of BWidget, it may be necessary to amend the options database for Slab widgets.

    There will be little difference between BWidget and Slab, if catch-all options such as
            option add *background  #d9d9d9
    are used.