PROMPT -- Prompt Boxes 1) Usage | OBJECT pmt[MENU]; A PROMPT instance has no state, but all information required for creating a prompt box is passed to it using arguments. There is only one singe method called INPUT. When an INPUT message is sent to an instance of PROMPT, a prompt box will be displayed on the terminal screen. The terminal will be put into raw mode, allowing the user to edit the content of the prompt box interactively. When the box is closed, it will not be removed from the screen. The PROMPT class uses the color set structure described in the 'common data structures' section. 2) Methods 2.1 INPUT | PMT.INPUT(x, y, lx, max, cs, buffer, xkeys) | ! Num,Num,Num,Num,Bvec,Bvec,Vec => Key|-1 PMT.INPUT creates a one-line editing box with a length of LX characters at the ccorinates (X,Y) on the terminal screen. It prints the last LX characters of BUFFER in this window. If the length of the string in BUFFER is less than LX, it prints it left-justified and fills the rest of the window with blanks. The MAX argument specifies the maximum length of the string in BUFFER. BUFFER must provide space for MAX characters. The MAX value includes the terminating NUL character, so only up to MAX-1 characters may be entered. The XKEYS argument is a vector of 'exit keys', where the first member of the vector holds the number of keys contained in it. Pressing one of the keys defined in this vector causes the INPUT method to exit. MAX may be larger than or equal to LX. If MAX is greater than LX, INPUT will side-scroll the text if necessary. After painting the window, the terminal is put into raw mode and PMT.INPUT lets the user edit the content of string interactively. Keys used for editing are listed in the following section. PMT.INPUT uses a so-called 'smart default'. It is indicated by initially displaying the text of BUFFER using C_SELECT color. When the first key pressed by the user is not a navigation key, the key pressed replaces the entire string. When a navigation key is pressed, the color changes to C_TEXT and the text can be edited normally. PMT.INPUT returns the key last pressed. A special return value of -1 indicates that the specified length LX is too long (>128 characters). 2.2 Editing Keys The following keys may be used for editing text in prompt boxes (^X denotes [control]+[X], K_X denotes ttyctl.K_X): Key Alt. Description --- ---- ----------- K_LEFT ^P move to the left one character K_RIGHT ^N move to the right one character K_DEL ^D delete the character on the right BACKSPACE . delete the character on the left ^U . delete all characters K_HOME ^A move to the first character K_END ^E move behind the last character ^V . insert the character typed next (quote) Other characters will be inserted literally, if their ASCII codes are below 256. When a character contained in the XKEYS set is pressed, the method exits immediately, returning the key pressed. XKEYS is checked before other bindings. Therefore, including 'X' in the exit key set, for example, would make PMT.INPUT exit when an uppercase 'X' is typed, rendering the input of capital X characters impossible. 3) Common Data Structures 3.1 CSET -- Color Sets The color set structure CSET, which is implemented in the FILEBOX, FORM, MENU, and PROMPT classes, has the following members: Member Used for... C_BACKGROUND box backgrounds C_FRAME drawing box frames C_TEXT writing text C_SOTEXT writing higlighted text C_SELECT drawing the selection bar For the exact usage of this structure, see the description of the classes which use it. The CSET structure has the same layout in all classes. Therefore, one and the same color set may be used in file boxes, forms, menues, and prompt boxes. 3.2 FSET -- Frame Character Sets The frame character set structure FSET, which is implemented in the FILEBOX, FORM, and MENU classes, has the following members: F_UL upper left corner F_UR upper right corner F_LL lower left corner F_LR lower right corner F_HL horizontal lines F_VL vertical lines NOTICE: FSET is a packed structure. To define one, use var fs::FSET; and to access its members, use fs::F_UL, fs::F_UR, etc. EXAMPLE: Using the FSET structure PACKED"1234-|" would result in a box of the form | 1----------2 | | | | | | | 3----------4 The FSET structure has the same layout in all classes. Therefore, one and the same frame character set may be used in file boxes, forms, and menues.