Title

jabout.tcl

Introduction

The jabout.tcl library is distributed as part of the jstools package. It consists of one main procedure and a number of subsidiary procedures used by the jstools applications. It contains procedures to manage an `about' panel, with information about your application. (Actually, it can be used as a general­purpose richtext display mechanism.)

This document describes jabout.tcl version 4.0/4.0.

Usage

Accessing the Library

In order to use the jabout.tcl library, it (and any other libraries it depends on) must be in your Tcl auto_path, described in tclvars(n). Information about how to arrange that, and other conventions common to the jstools libraries, is in the Usage section of The jstools Libraries.

Specifying Text

The Tcl­syntax format for specifying richtext is defined by the jrichtext.tcl library, which jabout.tcl uses.

Credits and Copyright

Author

Jay Sekora

js@aq.org

http://shore.net/~js/

Copyright

The library is copyright © 1992-1995 by Jay Sekora, but may be freely redistributed under the conditions at the top of the file.

Overview

Procedures

j:about - create an about box

j:about:button - add a button to an about box

j:about_jay - return rich­text describing me

j:about_tktcl - return rich­text describing Tk and Tcl

j:about

Usage

j:about name [options] richtext

Options

-title title (localisable, default About)

Arguments

name is the name of the about­box window

richtext is the rich­text content of the about box

title is the window­manager title for the about box

Example

j:about .telephones -title "About Telephones" {

j:rt:hl "Telephones"

j:rt:cr

j:rt:rm "Telephones are extremely useful, "

j:rt:rm "but also sometimes extremely "

j:rt:it "annoying"

j:rt:rm " devices for communicating "

j:rt:rm "over long distances."

}

Description

This procedure creates and displays a new about panel containing richtext. The about panel's toplevel widget will be named name. (It's window­manager title will be title, if specified.) The about box will have a button labelled `OK' in the lower right which will destroy the panel. (The OK button is the default button, so the user can invoke it by pressing Return.)

Note that richtext is not looked up in the database; if you want it to be localisable you'll need to call j:ldb yourself.

j:about:button

Usage

j:about:button aboutbox label richtext

Arguments

aboutbox is the name of the about panel to add the button to

label is the text to display on the button (localisable)

richtext is the richtext the button should display in the about box

Example

j:about:button .about "Copyright" {

j:rt:rm "Copyright \251 1776 by George Washington"

j:rt:cr

j:rt:rm "All Rights Reserved."

}

Description

This procedure is used to add buttons to an existing about panel, so your users can choose among several topics for the about panel. If you only want your about panel to display one piece of text, you don't need to call this procedure, but if you have several topics - for instance, general information about your program, a copyright notice, and a list of contributing authors - you can add buttons to the about panel for each topic.

The button will be packed to the left of the `OK' button (or any previously­added buttons), and will be labelled with label. When invoked, it will display richtext in the about panel, replacing any text that was displayed before. (For this reason, if you add buttons to an about panel, one of the buttons should typically redisplay the initial contents of the panel.

Note that richtext is not looked up in the database; if you want it to be localisable you'll need to call j:ldb yourself.

j:about_jay

Usage

j:about_jay

Description

This procedure returns richtext (as defined by the jrichtext.tcl library) describing me. It's in the library as a convenience, so I can call it from all the jstools applications.

The text will be looked up in the natural­language string database as described in jldb.tcl with the key about:about_jay.

j:about_tktcl

Usage

j:about_tktcl

Example

j:about:button .about "Tk and Tcl" [j:about_tktcl]

Description

This procedure returns richtext describing Tk and Tcl. In English, the text is currently:

Tk and Tcl

This application is written in wish, a scripting shell for X Windows

applications based on the Tk toolkit, which in turn is based on

the Tcl language and scripting library, all amazingly useful tools

by John Ousterhout of Sun Microsystems.

The Internet newsgroup comp.lang.tcl is devoted to Tcl and related

tools, and a Tk/Tcl FAQ (`Frequently Asked Questions') is periodically

posted. The latest distributions are available on the FTP site

ftp.smli.com, and ftp.aud.alcatel.com has the FAQ and

user­contributed scripts.

If the user has selected a different language, the text will be looked up in the natural­language string database as described in jldb.tcl with the key about:about_tktcl.

A longer example

This is a simplified version of the code that generates the about panel for the jedit application:

set about_editor {

j:rt:hl "jedit"

j:rt:cr

j:rt:rm "by Jay Sekora, "

j:rt:tt "js@aq.org"

j:rt:par

j:rt:rm "A customisable text editor for X Windows."

j:rt:cr

j:rt:rm "Version 4.0/4.0."

}

j:about .about $about_editor

j:about:button .about {About jedit} $about_editor

j:about:button .about {About The Author} [j:about_jay]

j:about:button .about {About Tk and Tcl} [j:about_tktcl]

Bugs and Limitations

* Having to add a button for each topic is clumsy. It would be better if the argument to j:about were a list of topics and corresponding richtext, and there were a one­of­many selector of some kind to view different topics.

Future Directions

* The fonts used in a j:about panel should be configurable by the user. Perhaps the same is true of the size of the panel.