!SHORT:IO_AllowEsc Indicate if Esc key is operative IO_AllowEsc IOTTT Purpose To indicate if Esc key is operative Type Optional. Declaration IO_AllowEsc(OK:boolean); OK is true if you want to allow the user to ESCape. Uses CRT, FastTTT, DOS, WinTTT, KeyTTT, IOTTT. Remarks The default is false, i.e. Esc is in-operative. If the user does ESC the return code from IO_Edit is set to 1. Example USES CRT, FASTTTT, DOS, WINTTT, KEYTTT, IOTTT; BEGIN IO_ALLOWESC(FALSE); END. !SHORT:IO_DefineMsg Display message when user moves to specified imput field IO_DefineMsg IOTTT Purpose To display a message when the user moves to the specified input field. Type Optional. Declaration IO_DefineMsg(ID, X, Y:byte;ST : string); ID is the ID number of the input field assigned with this message. X is the X coord of the first char of the message Y is the Y coord or display line of the message ST is the text or message Uses CRT, FastTTT, DOS, WinTTT, KeyTTT, IOTTT. Remarks Every input field is assigned an ID in the IO_DefineStr routine. You can display a message when the user moves to any input field. When the user exits the field, the message is removed and the original screen content (which was overlayed by the message) is restored. You can define unique messages for one, some or all of the input fields. Example USES CRT, FASTTTT, DOS, WINTTT, KEYTTT, IOTTT; BEGIN IO_DEFINEMSG(7,1,25,'INPUT THE CHEST MEASUREMENT'); END. The message "Input the chest measurement" will be displayed at the bottom left of the screen, whenever the cursor is moved to input field 7. !SHORT:IO_DefindStr Define all characteristics of specific input field IO_DefineStr IOTTT Purpose To define all the characteristics of a specific input field. This is the major procedure in the IOTTT unit. Type Mandatory Declaration IO_DefineStr(ID, U,D,L,R, X,Y: byte; var DefString : string; DefFormat : string); See Remarks. Uses CRT, FastTTT, DOS, WinTTT, KeyTTT, IOTTT. Remarks ID is the ID number for this input field. Every field is assigned an ID number, the same ID number is used by the IO_DefineMsg procedure. It is logical (but not mandatory) to start with ID number 1 and increment by one as you define each field. U,D,L,R are four bytes which represent the ID's of the fields which the cursor should move to if the up, down, left or right edit keys respectively are pressed, . For example, 5,2,5,2 would state that if the up or left keys are pressed, the cursor will move to field ID 5, and if the down or right keys are pressed, the cursor will move to field ID 2. Got it? Note that an ID of zero (0) indicates that the input session will terminate (as if the End key had been pressed). This is a useful tool if you want to end a session after the last field has been updated and the user tries to move forward to the next input field. X,Y simply represent the X and Y coordinates of the first character in the input field. This is how you tell the system the location of the field on the screen. DefString is a previously declared parameter of type string which is returned from the IO procedure with the user's input. If you want to provide the user with a default entry, then set the value of DefString to the required default string, otherwise set it to null i.e. ''. DefFormat which is the format of the input field (as discussed previously under the sub-heading FORMATTING). Example See Major example on page 64. !SHORT:IO_DisplayFields Display imput fields on screen, prior to imput IO_DisplayFields IOTTT Purpose To display the input fields on the screen, prior to input. Type Optional. Declaration IO_DisplayFields; Uses CRT, FastTTT, DOS, WinTTT, KeyTTT, IOTTT. Remarks Normally the fields are not displayed on the screen until the IO_Edit procedure is called. Call this procedure if you want to display the input fields before allowing the user to edit them. This procedure must be preceded by IO_SetFields, and all the IO_DefineStr statements. Example See Major example on page 64 !SHORT:IO_Edit Control user input of data IO_Edit IOTTT Purpose To control user input of data. Type Mandatory. Declaration IO_Edit(var Retcode: integer); Retcode must be an integer variable Uses CRT, FastTTT, DOS, WinTTT, KeyTTT, IOTTT. Remarks When you have declared all the parameters and defined all the IO procedures (including any optional procedures such as color changes) then you're ready to let the user input and update the fields. IO_Edit does this and passes control to the user. The procedure returns control to your program when the user has ended the update session, either by pressing End or Esc (if it is enabled) or by pressing any of the move to next field keys (Enter, Tab, etc.) when the next field has been defined as ID zero. The Retcode variable is updated with a return code for the edit session. The return codes are : 0 for successful completion 1 if user pressed Esc key Example See Major example on page 64. !IO_ResetFields Dispose of menory used during IO & reset input variables IO_ResetFields IOTTT Purpose To dispose of memory used during IO process and reset the input variables to default values. Type Mandatory. Declaration IO_ResetFields; Uses CRT, FastTTT, DOS, WinTTT, KeyTTT, IOTTT. Remarks This procedure is normally the next statement after IO_Edit. It discards all the field definitions from the Heap and sets all the optional settings (such as color) back to the default values. Example See Major example on page 64 !SHORT:IO_SetColors Set colors values IO_SetColors IOTTT Purpose To set the colors to your preferred values. Believe it or not, some people don't like my choice of colors! Type Optional Declaration IO_SetColors(HF,HB,LF,LB,MF,MB:byte); HF is the foreground color of the active field (0..15) HB is the background color of the active field (0..7) LF is the foreground color of the other fields (0..15) LB is the background color of the other fields (0..7) MF is the foreground color of the optional message (0..15) MB is the background color of the optional message (0..15) Uses CRT, FastTTT, DOS, WinTTT, KeyTTT, IOTTT. Remarks The Toolkit will default to one of two sets, depending on whether the system is monochrome or color. Example USES CRT, FASTTTT, DOS, WINTTT, KEYTTT, IOTTT; BEGIN IF BASEOFSCREEN = $B800 THEN IO_SETCOLORS(YELLOW, RED, BLACK, LIGHTGRAY, LIGHTCYAN, BLUE); ELSE IO_SETCOLORS(WHITE, BLACK, LIGHTGRAY, BLACK, BLACK, LIGHTGRAY); END. !SHORT:IO_SetFields Indicates total number of input fields IO_SetFields IOTTT Purpose Indicates the total number of input fields. Type Mandatory Declaration IO_SetFields(Tot: integer); Tot is the total number of input fields on the screen. Uses CRT, FastTTT, DOS, WinTTT, KeyTTT, IOTTT. Remarks This procedure must be the first IOTTT procedure. Pass the total number of input fields that will be defined. For example, IO_Setfields(5) advises the system that 5 input fields will be defined on the next input screen. The maximum number of fields is determined by the global constant MaxInputFields, see IOTTT.pas on the distribution disk. This constant may be changed to any desired value in the range 1..2000. Example See Major example on page 64 !SHORT:IO_SoundBeeper Switch beep on or off IO_SoundBeeper IOTTT Purpose To switch the (annoying) beep on or off. Type Optional. Declaration IO_SoundBeeper(OK:boolean); OK is true if you want the system to BEEEP when the user presses an invalid key. Uses CRT, FastTTT, DOS, WinTTT, KeyTTT, IOTTT. Remarks The default is true, i.e. the system will beep. Example USES CRT, FASTTTT, DOS, WINTTT, KEYTTT, IOTTT; BEGIN IO_SOUNDBEEPER(FALSE); END. !SHORT:IO_UserHook Provide way to call non-Toolkit Procedure IO_UserHook IOTTT NOTE This is not a procedure. IO_UserHook is declared as a pointer variable. Purpose To provide a way of intercepting the input and optionally calling a non-Toolkit procedure, i.e. a special procedure you have written. Type Optional Declaration IO_UserHook := @Procedure_Name Procedure_name is the actual name of the procedure which is to be called each time a key is pressed. Uses CRT, FastTTT, DOS, WinTTT, KeyTTT, IOTTT. Remarks The procedure must be declared as follows: Example {$F+} PROCEDURE_NAME(CH:CHAR; FIELDID: INTEGER; VAR RETURNSTR: STRING); BEGIN ..... {STATEMENTS} END; {$F-} The compiler directives (F and F-) designate the procedure as FAR. The Procedure_Name can be any valid procedure name, and this procedure may call other procedures. The 3 procedure parameters must be defined in the order shown. Ch will be the value of the character input by the user ,refer to appendix B for a list of the codes. Check this variable immediately and EXIT the procedure if it is not one of the special keys you are trying to intercept. FieldID will indicate the ID of the field the user is currently editing. ReturnStr is passed to the procedure with the current field value. You may update this variable to reset the current value of the field. Example See IOdem.pas on the distribution disk.