Home > Software > TWO > Doc

FJL: TWO Library

TWO = Tcl/tk Widget add-On

The TWO Library is a collection of TCL-only compund widgets, also known as "megawidgets", and a bunch of accompaining packages. A compound widget is built using normal Tk widgets and can be used like an ordinary Tk widget (wherever possible). It does not try to hide its internal structure to commands like "winfo" or "bind".

Some general notes on using, naming conventions and internal structure are available.

For new versions have a look at the TWO homepage: Comments, bug reports and especially patches and code submissions are always welcome!

Table of Contents

  1. Screenshots
  2. Widgets
  3. Additional Commands
  4. Demo Applications
  5. Using this library

1. Screenshots

Click on the thumbnails to show large image:

Screenshot 1 Screenshot 2 The first screenshot shows a toplevel window with a toolbar. There are several buttons, checkbuttons and a combobox in it. Please note that the toolbar can be torn off.

The main area is a MDI with 5 slave widgets, 2 of them are minimized. All slave windows are editor widgets, the active one is split into two parts (both showing the same editable text, separated by a splitter).

The style of all megawidgets (where suitable) is set to windows, but the application is run on UNIX.

The second screenshot shows a help window. It also has ist own toolbar. The main area contains the widget (sorry, text is in German language). There are some embedded images, and some links.

2. Widgets

An automatic scrollbar: it is only visible when it is really needed, i.e. it automatically disappears whenever there is nothing to be scrolled.
Slightly improved Tk button (interprets &)
Slightly improved Tk checkbutton (interprets &)
Like the windows combobox. Combines an entry widget and a drop-down list (menu) in one widget. The drop-down list is exposed by clicking the button on the right side of the the entry widget; the drop-down list can be resized interactively.
A convenience wrapper around the two_combobox widget which provides an entry with a command history.
An ASCII text editor; extends two_text (also part of this library). It provides methods to open/save files into the widget and can be split into two parts (using the splitter) which show different parts of the same file.
A simple HTML 2.0 widget used to display, eg., online help. Almost all of HTML 2.0 is recognized, but FORMS currently are not supported. The widget knows hyperlinks and a page history.
"Compile" HTML files (and images) to TCL, i.e., create code which pre-loads those pages into the two_html.n widget or creates an array.
Slightly improved Tk label (interprets &)
A tk_messageBox which sets the parent widget to a reasonable value.
An implementation of the MDI widget known from Windows. An MDI is like a windowmanager within another window: you can open an arbitrary number of slave windows, move, resize, maximize and minimize them, and sure enough close them. There are window menus and a root menu.
Slave widgets (panes) are arranged in rows or columns. The size of each pane can be controlled by draging the resize handler between each pane.
A fake shell widget used to run interactive applications. It shows a fake prompt and fake command string.
A toolbar may consist of buttons, checkbuttons, radiobuttons, and combobox, it can be torn off and the buttons have a flat appearance.
Thin wrapper around tk_messageBox with default [two_ct] as default value for parent widget.
Tk menu command with better support for setting accelerator keys, underlinig and tooltips.
Tk text widget with some different keyboard bindings (no emacs bindings, better CTRL-left/right handling etc.) and a (simple) auto indent mode. It has unlimited undo/redo capability and can be coupled with a slave xtext.

3. Additional Commands

Load and save TCL arrays to files.
A replacements for the standard Tk bgerror handler: the user can send bug reports to the maintianer of the software (eror message, call stack, and user's own comments).
Center a toplevel widget on the screen.
Get the current toplevel widget (with one of it's children having the focus).
Conditinal execution of code.
Conditinal execution of code.
Conditinal execution of code.
Conditinal execution of code.
Conditinal execution of code.
This library proviedes several icons wich an be used in a toolbar.
Invoke a Tk button with visual feedback (flashing the button as if it were pressed with the mouse).
Record and playback of key events.
Replacement for tcl pwd and cd commands which emulates the behaviour of ksh concerning symbolic links to directories.
Disable importing and exporting the selection and clipboard. Only useful under some rather rare circumstances.
Several option settings for making Tk applications more beautiful on several UNIX systems (written for CDE on HP/UX) and some workarounds. or twopre.tcl.1
"Precompile" a tcl file. It does inlining of TCL source and image create commands .
Comments can be removed and the additional tclpre set/if/else/endif commands are processed.
Emulates the filter, which in turn emulates the C preprocessor.
Show a toplevel (might be iconified, withdrawn or simply hidden). If no previous position has been selected, center it on the screen.
Show little help messages if the mouse pointer rests a minimum amount of time over a widget.
Conditinal execution of code.
Cotains some of the above utility procedures.

4. Demo Applications

This distribution comes with several little demo applications. Their main purpose is to show how to use the widgets. Some of them might be useful as building blocks for larger applications.

5. Using this Library

There are several ways to use this library:

  1. If you don't want to install the files, then you can simply use the tcl source command for each file that you need. Please note that some files require some others, so there are restrictions on their order.
  2. An alternative is to only source the tclpre.tcl and libw.tcl files.
  3. Use the command lappend auto_path /path/to/lib to make the package require commands work without installing the library
  4. Install the library and use package require

TWO is available under the same license as Tcl/Tk: See the file license.terms.

[FJL] [Music] [Software] [Impressum] [Mail]
Last Modified: 2005-09-10 (