Editing single and multiple lines of text

The program Edit.m3 illustrates how to use the multiple line and single line text editors. The VBTkit module TextPort does all the work. The program creates two TextPort VBTs. One is the size of just one line of text; the other holds as many lines as it can. Both TextPorts are edited using emacs-like commands. This capability is provided by the TextPort along with several other editing options. The application prints the text of the TextPorts if either has been modified. The function TextPort.IsModified provides the test, and the function TextPort.Get retrieves the text.

The following images

show two views of the application after some editing has modified the original contents of the TextPorts. A long thin, vertical bar marks the position in the text where keyboard input will affect the text. A slightly thicker line shows the end of the multi-line text or where a line has been wrapped around the window.

The module TextPort provides a VBT with quite sophisticated functionality. This module is part of VBTKit---an additional collection of modules for Trestle. All the previous programs can be compiled without the VBTKit interface files and do not require the VBTKit library. This program and most of the rest of the programs require VBTKit.