---
name: "gk_notifier"
section: "3gk"
platform: "linux"
package: "groupkit"
version: "3.2-1"
release: "Debian 1.3 (Bo)"
platforms: ["linux"]
url: "https://new.carta.tech/gk_notifier"
---

# gk\_notifier(3gk)

create a bind like mechanism for general notifications

## NAME

gk\_notifier - create a bind like mechanism for general notifications

## SYNOPSIS

- **gk\_notifier** *name*

  ## DESCRIPTION

The gk\_notifier command creates a new gk\_notifier object.  A notification object provides the same type of functionality as Tk's bind command -- attaching callbacks to events -- but generalizes the notion away from X11 events.  Users of the gk\_notifier object can both generate arbitrary events, as well as bind callbacks to arbitrary events.  Multiple  gk\_notifier objects can exist in an application, and multiple bind callbacks can fire on a single event.

Events consist of two parts: an event type and a list of event attributes. In general, all events of the same type will have the same attributes, though the specific values of the attributes may differ.  Attributes are specified when the event is generated, and can be retrieved via substitutions in event bindings.

The gk\_notifier command creates a Tcl command which is used to access the created gk\_notifier object.  If the name of the object is specified as  "-anonymous", the gk\_notifier command will assign a name.  The name of the gk\_notifier object is returned.

## GK\_NOTIFIER OBJECT COMMAND

The gk\_notifier command creates a new Tcl command whose name is *name*. This command may be used to invoke various operations on the gk\_notifier object.  The following operations are allowed:

- *name* **notify** *type attributes*

  Generate an event of type *type*.  The event attributes are specified by *attributes*, which is a list of pair.  The first element of each pair is a single character used to refer to the attribute in bindings.  The second element of each pair is the value of the attribute.

- *name* **bind** *type handler*

  Create a new binding for events having type *type*.  When an event of that type is generated, the Tcl script specified in *handler* is invoked.  The *handler* is first searched for any percent signs, which flag event substitutions.  For each percent sign, the character after the percent sign is examined.  If it matches one of the event attribute characters specified when the event was generated, the corresponding value of the attribute from the event is substituted. Two special cases exist: the string "%%" is used to specify a single percent sign, and the string "%E" is substituted with the event type. The command returns an identifier for the binding, which can be used to later remove the binding with the **delete** subcommand.

- *name* **delete** *binding*

  Delete a binding previously created using the **bind** subcommand. The *binding* parameter is the name of the binding to delete, returned from **bind**.

- *name* **destroy**

  Destroy the gk\_notifier object and its Tcl command.

## EXAMPLE

-

  ```
  gk_notifier announce
  announce bind someEvent "doEvent %U %R %E"
  proc doEvent {usernum roomname event} {
    puts "u->$usernum r->$roomname e->$event"
  }
  announce notify someEvent [list [list U 25] [list R Foyer]]
  ```

## NOTE

Currently, bindings are fired in the order they are created.  Future versions may include a "-before" option on the bind subcommand, to  insert the new binding relative to other bindings.

## AUTHOR

Mark Roseman (roseman@cpsc.ucalgary.ca)
