jabout.tcl
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 generalpurpose richtext display mechanism.)
This document describes
jabout.tcl version 1998.09.30.
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 Tclsyntax format for specifying richtext is defined by the
jrichtext.tcl library, which
jabout.tcl uses.
Author
Jay Sekora
js@aq.org
http://www.aq.org/~js/
Copyright
The library is copyright © 1992-1998 by Jay Sekora, but may be
freely redistributed under the conditions at the top of the file.
Procedures
j:about - create an about box
j:about:button - add a button to an about box
j:about_jay - return richtext describing me
j:about_tktcl - return richtext describing Tk and Tcl
Usage
j:about
name
[options]
richtext
Options
-title
title
(localisable, default
About)
Arguments
name is the name of the aboutbox window
richtext is the richtext content of the about box
title is the windowmanager 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 windowmanager 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.
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
previouslyadded 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.
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 naturallanguage string database as described in
jldb.tcl with the key
about:about_jay.
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
usercontributed scripts.
If the user has selected a different language, the text will be
looked up
in the naturallanguage string database as described in
jldb.tcl with the key
about:about_tktcl.
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 1998.09.30."
}
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 oneofmany selector of some kind to view different topics.