Next: , Previous: , Up: Classes   [Index]


ANSITextEntryPane

ANSITextEntryPane Class

A ANSITextEntryPane object prompts the user for text input and returns the input to the application program. Like other subclasses of ANSIWidgetPane, this class uses the methods of that class or re-implements them as necessary. See ANSIWidgetPane.

The widget can be displayed independently; that is, it can be popped up on its own, as in this example.

int main () {
  ANSITextEntryPane new textEntry;
  String new inputText;

  textEntry withPrompt "Please enter some text: ";
  inputText = textEntry show 10, 10;
  printf ("\nYou typed: %s\n", inputText);
  textEntry cleanup;
}

To pop up an ANSITextEntryPane over another pane, the program must also configure and define the widget’s parent pane.

int main () {
  ANSITerminalPane new mainPane;
  ANSITextEntryPane new textEntry;
  String new inputText;

  mainPane initialize 1, 1, 80, 24;
  mainPane refresh;

  mainPane gotoXY 29, 10;
  mainPane printOn "Parent Pane";
  mainPane gotoXY 25, 11;
  mainPane printOn "Please press [Enter].";
  mainPane refresh;

  getchar ();  /* Actual apps should use getCh, etc. */

  textEntry parent mainPane;
  textEntry withPrompt "Please enter some text: ";
  inputText = textEntry show 10, 10;
  mainPane refresh;
  
  printf ("\nYou typed: %s\n", inputText);

  getchar ();

  textEntry cleanup;
  mainPane cleanup;
}

Instance Variables

promptText

The text of the entry pane’s prompt. The default is an empty String object.

inputBuffer

A String object that contains the user’s input.

inputLength

The width in characters of the text entry. The default is 20.

Instance Methods

handleInput (void)

Process InputEvent objects from the receiver’s paneStream input handle.

inputWidth (Integer width)

Set the width, in characters, of the input entry box. The default is 20.

new (String paneName)

Creates a new ANSITextEntryPane object. Also uses the withShadow and withBorder messages from ANSITerminalPane class, and the openInputQueue message from ANSITerminalStream class.

If more that one argument is given in the argument list, create new ANSITextEntryPane objects with the arguments’ names.

show (int x_origin, int y_origin)

Display the receiver pane and return input from the user.

withdraw

Remove the receiver widget from the display. If the widget is drawn over another pane object, unmap the receiver from the parent pane. If the receiver is displayed independently, clear the display before returning.

withPrompt (String promptText)

Set the receiver’s prompt to promptText.


Next: , Previous: , Up: Classes   [Index]