Subject: ANNOUNCE: Widget callback package Wcb 2.1 - DN [1]
Csaba Nemethi <csaba.nemethi@t-online.de> - 05 Feb 2000 - comp.lang.tcl
I am pleased to announce Version 2.1 of the widget callback package Wcb.
What is new in Wcb 2.1?
-----------------------
1. Fixed a bug in the procedure "cbprepend", introduced in version 2.0.
2. Included a new demo script using an activate callback for a listbox.
This new example is also discussed in the manual file "wcb.html".
3. Minor improvements in the code and documentation.
What is Wcb?
------------
Wcb is a library package for Tcl/Tk version 8.0 or higher, written in
pure Tcl/Tk code. It contains a few commands providing a simple and
GENERAL solution to problems like the following:
- How to restrict the set of characters that the user can type or
paste into an entry or text widget?
- How to manipulate the user input characters before they are
inserted into an entry or text widget? In the case of a text
widget: How to change the font, colors, or other attributes of
the input characters?
- How to set a limit for the number of characters that can be typed
or pasted into an entry widget?
- How to protect some parts of the text contained in an entry or text
widget from being changed by the user?
- How to define notifications to be triggered automatically after
text is inserted into or deleted from an entry or text widget?
- How to define some actions to be invoked automatically whenever the
insertion cursor in an entry or text widget is moved?
- How to define a command to be called automatically when selecting a
listbox element?
- How to disable any or all items of a listbox, i.e., how to protect
them from being selected?
In most books, FAQs, newsgroup articles, and widget sets, you can find
INDIVIDUAL solutions to some of the above problems by means of widget
bindings. This approach quite often proves to be incomplete.
The Tk core addresses just a few of the above problems: In Tk 8.1 the
<<ListboxSelect>> virtual event for listbox widgets was introduced, and
Tk 8.3 supports widget options for entry validation. Also these
improvements are of INDIVIDUAL nature.
The package Wcb goes a completely different way: Based on redefining
the Tcl command corresponding to a widget, the main Wcb procedure
"callback" enables you to associate arbitrary commands with some entry,
listbox, and text widget operations. These commands will be invoked
automatically in the global scope whenever the respective widget
operation is executed. You can request that these commands be called
either before or after executing the respective widget operation, i.e.,
you can define both before- and after-callbacks. From within a before-
callback, you can cancel the respective widget command by invoking the
procedure "cancel", or modify its arguments by calling "extend" or
"replace".
Besides these (and three other) general-purpose commands, the Wcb
package exports three utility procedures for entry widgets, as well as
some before-insert callbacks for entry and text widgets, which you can
use directly or modify to suit your needs.
How to get it?
--------------
Wcb is available for free download from the Web page
http://www.nemethi.de
The distribution file is "wcb2.1.tar.gz" for UNIX and "wcb2_1.zip" for
Windows 95/98/NT. These files contain the same information, except for
the additional carriage return character preceding the linefeed at the
end of each line in the text files for Windows.
How to install it?
------------------
Install the package as a subdirectory of one of the directories given
by the "auto_path" variable. For example, you can install it as a
directory at the same level as the Tcl and Tk script libraries. The
locations of these library directories are given by the "tcl_library"
and "tk_library" variables, respectively.
To install Wcb on UNIX, "cd" to the desired directory and unpack the
distribution file "wcb2.1.tar.gz":
gunzip -c wcb2.1.tar.gz | tar -xf -
This command will create a directory named "wcb2.1", with the
subdirectories "demos", "doc", and "scripts".
On Windows 95/98/NT, use WinZip or some other program capable of
unpacking the distribution file "wcb2_1.zip" into the directory
"wcb2.1", with the subdirectories "demos", "doc", and "scripts".
How to use it?
--------------
To be able to use the commands and variables implemented in the package
Wcb, your scripts must contain one of the lines
package require Wcb
package require wcb
Since the package Wcb is implemented in its own namespace called "wcb",
you must either import the procedures you need, or use qualified names
like "wcb::callback".
For a detailed description of the commands and variables provided by Wcb
and of the examples contained in the "demos" directory, see the manual
file "wcb.html" in the "doc" directory.
--
Csaba Nemethi http://www.nemethi.de mailto:csaba.nemethi@t-online.de
Last modified
2000-02-10
2000-02-10
(195.108.246.50)
Note: you are looking at
the snapshot of an old wiki
- much of this information
is likely to be very outdated
