Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ANNOUNCE: Widget callback package Wcb 2.6

0 views
Skip to first unread message

Csaba Nemethi

unread,
Sep 3, 2001, 12:48:24 AM9/3/01
to
I am pleased to announce Version 2.6 of the widget callback package Wcb.

What is new in Wcb 2.6?
-----------------------

1. Fixed a bug introduced in version 2.5 in the private procedure
"processCmd" (thanks to Juri Shimon for his bug report).

2. Added the before-insert callbacks "checkStrForRegExp" and
"checkStrsForRegExp".

3. Internationalized the sample before-insert callbacks
"checkStrFor*" and "checkStrsFor*" for Tk versions 8.1 or higher.

4. The text widget callbacks "checkStrsFor*" now accept also "\n"
characters.

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, spinbox, or text widget?
- How to manipulate the user input characters before they are
inserted into an entry, spinbox, 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 or spinbox widget?
- How to protect some parts of the text contained in an entry,
spinbox, 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, spinbox, or text
widget?
- How to define some actions to be invoked automatically whenever the
insertion cursor in an entry, spinbox, 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, Tk
versions 8.3 and higher support widget options for entry validation,
and the spinbox widget (introduced in Tk 8.4) provides the same
validation facility. Finally, Tk 8.4 supports the "disabled" state for
listbox widgets. However, 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, spinbox, tablelist (see http://www.nemethi.de), 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 four other) general-purpose commands, the Wcb
package exports three utility procedures for entry and spinbox widgets,
as well as some before-insert callbacks for entry, spinbox, 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.6.tar.gz" for UNIX and "wcb2_6.zip" for
Windows. 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.6.tar.gz":

gunzip -c wcb2.6.tar.gz | tar -xf -

This command will create a directory named "wcb2.6", with the
subdirectories "demos", "doc", and "scripts".

On Windows, use WinZip or some other program capable of unpacking the
distribution file "wcb2_6.zip" into the directory "wcb2.6", 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....@t-online.de

[[Send Tcl/Tk announcements to tcl-an...@mitchell.org
Send administrivia to tcl-announ...@mitchell.org
Announcements archived at http://groups.yahoo.com/group/tcl_announce/
The primary Tcl/Tk archive is ftp://ftp.neosoft.com/pub/tcl/ ]]

0 new messages