listener(n)                  Tk Built-In Commands                  listener(n)



NAME
       listener - Create and manipulate listener widgets

SYNOPSIS
       (listener widget-name ?options?)


WIDGET-SPECIFIC OPTIONS
       [:command ] Specifies a STk procedure to associate with the listener.
       This procedure is invoked when a complete s-expr is entered in the
       listener. This s-expr is passed as a string to the procedure. The
       procedure must return the string which will be inserted in response to
       the s-expr input. The default procedure is the Identity procdure.
       [:output-color ] Specifies the color used the output lines [:prompt-
       color ] Specifies the color used for the prompt [:prompt ] Specifies
       the prompt used for reading s-expr. Defaults to "> "


DESCRIPTION
       The listener procedure creates a new text window (given by the
       widget-name argument) and associates it bindiangs suitable for a
       listener.  Since a listener is in fact a text widget, all the options
       of text are applicable to a listener.  The listener procedure returns
       its widget-name argument.  At the time this procedure is invoked, there
       must not exist a window named widget-name, but widget-name's parent
       must exist.

       A listener is a widget for doing interactive I/O. Typical usage for
       this widget consists of a text window whose inputs are sent to the
       Scheme evaluator and whose result is displayed in the listener. An
       example for this is shown at the end of this page.


WIDGET PROCEDURE
       All the text procedure are avialble for a listener, plus


       (listener-insert-string widget-name str)
              inserts the string str just before the input prompt.

EXAMPLE
       Hereafter is a simple use of the listener widget which interact with
       the evaluator.

       (listener '.t :width   50
                     :height  10
                     :command (lambda (x)
                                (eval-string x (global-environment)))) (pack
       .t)

DEFAULT BINDINGS
       The defaults bindings are identical to the text bindings.


SEE ALSO
       text



STk                                   3.1                          listener(n)
