listener

Create and manipulate listener widgets

SYNOPSIS

(listener widget-name ?options?)

WIDGET-SPECIFIC OPTIONS

Name:
Class:
Option keyword: :command
STklos slot name: 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.

Name:
Class:
Option keyword: :output-color
STklos slot name: output-color
Specifies the color used the output lines

Name:
Class:
Option keyword: :prompt-color
STklos slot name: prompt-color
Specifies the color used for the prompt

Name:
Class:
Option keyword: :prompt
STklos slot name: 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

Back to the STk main page