Go to the first, previous, next, last section, table of contents.


input Extensions Module

Input provides tools to let the window manager read a line of input from the user and act on it. It provides a subclass of KeyGrabKeyboard (see section keys Extension Module) for configuration, and two classes to read input.

Class: InputKeyHandler ( handler, displayer )

Creates a key handler class for editing input. The handler is any object acceptable to KeyGrabKeyboard. displyer.show(left, right) is called to display the two strings with a curser between them. displayer.do(text) is called when the user is through editing the input. displayer.abort() is called if the user aborts the operation.

InputKeyHandler provides the following methods that may be bound to keystrokes like any other keyhander. See section keys Extension Module.

Method: InputKeyHandler _insert ( event )
The key pressed to generate event is inserted into the buffer at the cursor. All the characters of the latin1 character set are bound to this by default.

Method: InputKeyHandler _forw (event)
Move the cursor forward one character in the edited text.

Method: InputKeyHandler _back (event)
Move the cursor backward one character in the edited text.

Method: InputKeyHandler _delforw (event)
Delete the character in front of the cursor in the edited text.

Method: InputKeyHandler _back (event)
Delete the character behind of the cursor in the edited text.

Method: InputKeyHandler _end (event)
Move the cursor to the end of the edited text.

Method: InputKeyHandler _begin (event)
Move the cursor to the beginning of the edited text.

Method: InputKeyHandler _back (event)
Delete all the characters from the cursor to the end of the edited text.

Method: InputKeyHandler _paste (event)
If text is selected, it will be inserted into the edited text at the cursor, as if typed by the user. For this to work, the handler must be an instance of wmanager.Window. If that is not the case, or no text is currently selected, this does nothing.

Method: InputKeyHandler _done (event)
Finishes the action, and calls displayer.do passing it the edited text.

Method: InputKeyHander _abort (event)
Aborts the input operation, callgin displayer.abort().

Class: inputWindow ( prompt, screen, length = 30)

inputWindow is a class that creates a window on screen and uses an InputKeyHandler to read input from the user. The user is prompted with prompt. Space is left for length extra characterfs to display in the window, but it will scroll to keep the cursor always in view.

Instance Variable: inputWindow fontname
Instance Variable: inputWindow foreground
Instance Variable: inputWindow background
Instance Variable: inputWindow borderwidth

The attributes of the window used to read the input. The defaults are 9x15 for the fontname, a black foreground on a white background, and a borderwidth of 3.

Instance Variable: inputWindow height
Instance Variable: inputWindow width

The height and width of the window will be available as attributes after the inputWindow is instantiated.

Method: inputWindow read ( action, handlertype, x = 0, y = 0 )

The read method of the inputWindow is called to read text from user and act on it. handlertype should be a subclass of InputKeyHandler with appropriate bindings for editing the text. action will be invoked with the edited text as it's sole argument when handlertypes's _done action is invoked.

Class: modeInput ( prompt, screen )

An modeInput object uses the modewindow on screen to read input from the user. See section modewindow Extension Module. It has an read method that takes the same arguments as the read method of inputWindow, except that x and y are ignored.


Go to the first, previous, next, last section, table of contents.