Tcl Library Source Code

Documentation
Login


[ Main Table Of Contents | Table Of Contents | Keyword Index | Categories | Modules | Applications ]

NAME

uevent - User events

Table Of Contents

SYNOPSIS

package require Tcl 8.5 9
package require uevent ?0.3.2?
package require logger

::uevent::bind tag event command
command tag event details
::uevent::unbind token
::uevent::generate tag event ?details?
::uevent::list
::uevent::list tag
::uevent::list tag event
::uevent::watch::tag::add pattern command
{*}command bound tag
{*}command unbound tag
::uevent::watch::tag::remove token
::uevent::watch::event::add tag_pattern event_pattern command
{*}command bound tag event
{*}command unbound tag event
::uevent::watch::event::remove token

DESCRIPTION

This package provides a general facility for the handling of user events. Allows the binding of arbitrary commands to arbitrary events on arbitrary tags, removal of bindings, and event generation.

The main difference to the event system built into the Tcl/Tk core is that the latter can generate only virtual events, and only for widgets. It is not possible to use the builtin facilities to bind to events on arbitrary (pseudo-)objects, nor is it able to generate events for such.

Here we can, by assuming that each object in question is represented by its own tag. Which is possible as we allow arbitrary tags.

More differences:

  1. The package uses only a two-level hierarchy, tags and events, to handle everything, whereas the Tcl/Tk system uses three levels, i.e. objects, tags, and events, with a n:m relationship between objects and tags.

  2. This package triggers all bound commands for a tag/event combination, and they are independent of each other. A bound command cannot force the event processing core to abort the processing of command coming after it.

API

The package exports eight commands, as specified below. Note that when the package is used from within Tcl 8.5+ all the higher commands are ensembles, i.e. the :: separators can be replaceed by spaces.

Bugs, Ideas, Feedback

This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category uevent of the Tcllib Trackers. Please also report any ideas for enhancements you may have for either package and/or documentation.

When proposing code changes, please provide unified diffs, i.e the output of diff -u.

Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar.

SEE ALSO

hook(n)

KEYWORDS

bind, event, generate event, hook, unbind

CATEGORY

Programming tools

COPYRIGHT

Copyright © 2007-2012 Andreas Kupries