home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / TJOCKREF.ZIP / IOTTT.TXT < prev    next >
Encoding:
Text File  |  1988-08-20  |  11.8 KB  |  374 lines

  1. !SHORT:IO_AllowEsc       Indicate if Esc key is operative
  2. IO_AllowEsc                                                      IOTTT
  3.           
  4.  
  5.  
  6. Purpose   To indicate if Esc key is operative
  7.  
  8. Type Optional.
  9.  
  10. Declaration    IO_AllowEsc(OK:boolean);
  11.                     
  12.           OK is true if you want to allow the user to ESCape.
  13.  
  14. Uses CRT, FastTTT, DOS, WinTTT, KeyTTT, IOTTT.
  15.  
  16. Remarks   The default is false, i.e. Esc is in-operative.
  17.                     
  18.           If the user does ESC the return code from IO_Edit is set to
  19.           1.
  20.  
  21. Example
  22.  
  23.  
  24.                USES CRT, FASTTTT, DOS, WINTTT, KEYTTT, IOTTT;
  25.                BEGIN
  26.                  IO_ALLOWESC(FALSE);
  27.                END.
  28.           
  29.  
  30.                
  31.  
  32.  
  33. !SHORT:IO_DefineMsg      Display message when user moves to specified imput field
  34. IO_DefineMsg                                                     IOTTT
  35.      
  36.  
  37.  
  38. Purpose   To display a message when the user moves to the specified
  39.           input field.
  40.  
  41. Type Optional.
  42.  
  43. Declaration    IO_DefineMsg(ID, X, Y:byte;ST : string);
  44.                
  45.           ID is the ID number of the input field assigned with this
  46.           message.
  47.           X is the X coord of the first char of the message
  48.           Y is the Y coord or display line of the message
  49.           ST is the text or message
  50.  
  51. Uses CRT, FastTTT, DOS, WinTTT, KeyTTT, IOTTT.
  52.  
  53. Remarks   Every input field is assigned an ID in the IO_DefineStr
  54.           routine.
  55.                
  56.           You can display a message when the user moves to any input
  57.           field. When the user exits the field, the message is removed
  58.           and the original screen content (which was overlayed by the
  59.           message) is restored.
  60.                
  61.           You can define unique messages for one, some or all of the
  62.           input fields.
  63.  
  64. Example
  65.  
  66.  
  67.                USES CRT, FASTTTT, DOS, WINTTT, KEYTTT, IOTTT;
  68.                BEGIN
  69.                  IO_DEFINEMSG(7,1,25,'INPUT THE CHEST MEASUREMENT');
  70.                END.
  71.      
  72.  
  73. The message "Input the chest measurement" will be displayed at the
  74. bottom left of the screen, whenever the cursor is moved to input field
  75. 7.
  76.  
  77.  
  78.  
  79.  
  80. !SHORT:IO_DefindStr      Define all characteristics of specific input field
  81. IO_DefineStr                                                     IOTTT
  82.           
  83.  
  84.  
  85. Purpose   To define all the characteristics of a specific input field.
  86.           This is the major procedure in the IOTTT unit.
  87.  
  88. Type Mandatory
  89.  
  90. Declaration    IO_DefineStr(ID,
  91.                U,D,L,R,
  92.                X,Y: byte;
  93.                var DefString : string;
  94.                DefFormat     : string);
  95.                     
  96.            See Remarks.
  97.  
  98. Uses CRT, FastTTT, DOS, WinTTT, KeyTTT, IOTTT.
  99.  
  100. Remarks   ID is the ID number for this input field. Every field is
  101.           assigned an ID number, the same ID number is used by the
  102.           IO_DefineMsg procedure. It is logical (but not mandatory) to
  103.           start with ID number 1 and increment by one as you define
  104.           each field.
  105.                     
  106.           U,D,L,R are four bytes which represent the ID's of the
  107.           fields which the cursor should move to if the up, down, left
  108.           or right edit keys respectively are pressed, . For example,
  109.           5,2,5,2    would state that if the up or left keys are
  110.           pressed, the cursor will move to field ID 5, and if the down
  111.           or right keys are pressed, the cursor will move to field ID
  112.           2. Got it? Note that an ID of zero (0) indicates that the
  113.           input session will terminate (as if the End key had been
  114.           pressed). This is a useful tool if you want to end a session
  115.           after the last field has been updated and the user tries to
  116.           move forward to the next input field.
  117.                     
  118.           X,Y simply represent the X and Y coordinates of the first
  119.           character in the input field. This is how you tell the
  120.           system the location of the field on the screen.
  121.                     
  122.           DefString is a previously declared parameter of type string
  123.           which is returned from the IO procedure with the user's
  124.           input. If you want to provide the user with a default entry,
  125.           then set the value of DefString to the required default
  126.           string, otherwise set it to null i.e. ''.
  127.                     
  128.           DefFormat which is the format of the input field (as
  129.           discussed previously under the sub-heading FORMATTING).
  130.  
  131. Example   See Major example on page 64.
  132.  
  133.  
  134.  
  135.  
  136. !SHORT:IO_DisplayFields  Display imput fields on screen, prior to imput
  137. IO_DisplayFields                                                 IOTTT
  138.      
  139.  
  140.  
  141. Purpose   To display the input fields on the screen, prior to input.
  142.  
  143. Type Optional.
  144.  
  145. Declaration    IO_DisplayFields;
  146.  
  147. Uses CRT, FastTTT, DOS, WinTTT, KeyTTT, IOTTT.
  148.  
  149. Remarks   Normally the fields are not displayed on the screen until
  150.           the IO_Edit procedure is called. Call this procedure if you
  151.           want to display the input fields before allowing the user to
  152.           edit them.
  153.                
  154.           This procedure must be preceded by IO_SetFields, and all the
  155.           IO_DefineStr statements.
  156.  
  157. Example   See Major example on page 64
  158.  
  159.  
  160.  
  161.  
  162. !SHORT:IO_Edit           Control user input of data
  163. IO_Edit                                                          IOTTT
  164.           
  165.  
  166.  
  167. Purpose   To control user input of data.
  168.  
  169. Type Mandatory.
  170.  
  171. Declaration    IO_Edit(var Retcode: integer);
  172.                     
  173.           Retcode must be an integer variable
  174.  
  175. Uses CRT, FastTTT, DOS, WinTTT, KeyTTT, IOTTT.
  176.  
  177. Remarks   When you have declared all the parameters and defined all
  178.           the IO procedures (including any optional procedures such as
  179.           color changes) then you're ready to let the user input and
  180.           update the fields. IO_Edit does this and passes control to
  181.           the user.
  182.                     
  183.           The procedure returns control to your program when the user
  184.           has ended the update session, either by pressing End or Esc
  185.           (if it is enabled) or by pressing any of the move to next
  186.           field keys (Enter, Tab, etc.) when the next field has been
  187.           defined as ID zero.
  188.                     
  189.           The Retcode variable is updated with a return code for the
  190.           edit session. The return codes are :
  191.                     
  192.                0 for successful completion
  193.                1 if user pressed Esc key
  194.  
  195. Example   See Major example on page 64.
  196.  
  197.  
  198. !IO_ResetFields          Dispose of menory used during IO & reset input variables
  199. IO_ResetFields                                                   IOTTT
  200.      
  201.  
  202.  
  203. Purpose   To dispose of memory used during IO process and reset the
  204.           input variables to default values.
  205.  
  206. Type Mandatory.
  207.  
  208. Declaration    IO_ResetFields;
  209.  
  210. Uses CRT, FastTTT, DOS, WinTTT, KeyTTT, IOTTT.
  211.  
  212. Remarks   This procedure is normally the next statement after IO_Edit.
  213.           It discards all the field definitions from the Heap and sets
  214.           all the optional settings (such as color) back to the
  215.           default values.
  216.  
  217. Example   See Major example on page 64
  218.  
  219.      
  220.  
  221.  
  222.  
  223.  
  224. !SHORT:IO_SetColors      Set colors values
  225. IO_SetColors                                                     IOTTT
  226.           
  227.  
  228.  
  229. Purpose   To set the colors to your preferred values. Believe it or
  230.           not, some people don't like my choice of colors!
  231.  
  232. Type Optional
  233.  
  234. Declaration    IO_SetColors(HF,HB,LF,LB,MF,MB:byte);
  235.                     
  236.            HF is the foreground color of the active field (0..15)
  237.            HB is the background color of the active field (0..7)
  238.            LF is the foreground color of the other fields (0..15)
  239.            LB is the background color of the other fields (0..7)
  240.            MF is the foreground color of the optional message (0..15)
  241.            MB is the background color of the optional message (0..15)
  242.  
  243. Uses CRT, FastTTT, DOS, WinTTT, KeyTTT, IOTTT.
  244.  
  245. Remarks   The Toolkit will default to one of two sets, depending on
  246.           whether the system is monochrome or color.
  247.  
  248. Example
  249.  
  250.  
  251.                USES CRT, FASTTTT, DOS, WINTTT, KEYTTT, IOTTT;
  252.                BEGIN
  253.                  IF BASEOFSCREEN = $B800 THEN
  254.                  IO_SETCOLORS(YELLOW, RED, BLACK, LIGHTGRAY,
  255.                  LIGHTCYAN, BLUE);
  256.                  ELSE
  257.                  IO_SETCOLORS(WHITE, BLACK, LIGHTGRAY, BLACK, BLACK,
  258.                  LIGHTGRAY);
  259.                END.
  260.           
  261.  
  262.  
  263.  
  264. !SHORT:IO_SetFields      Indicates total number of input fields
  265. IO_SetFields                                                     IOTTT
  266.      
  267.  
  268.  
  269. Purpose   Indicates the total number of input fields.
  270.  
  271. Type Mandatory
  272.  
  273. Declaration    IO_SetFields(Tot: integer);
  274.                
  275.           Tot is the total number of input fields on the screen.
  276.  
  277. Uses CRT, FastTTT, DOS, WinTTT, KeyTTT, IOTTT.
  278.  
  279. Remarks   This procedure must be the first IOTTT procedure. Pass the
  280.           total number of input fields that will be defined. For
  281.           example, IO_Setfields(5) advises the system that 5 input
  282.           fields will be defined on the next input screen.
  283.                
  284.           The maximum number of fields is determined by the global
  285.           constant MaxInputFields, see IOTTT.pas on the distribution
  286.           disk. This constant may be changed to any desired value in
  287.           the range 1..2000.
  288.  
  289. Example   See Major example on page 64
  290.  
  291.      
  292.  
  293.  
  294. !SHORT:IO_SoundBeeper    Switch beep on or off
  295. IO_SoundBeeper                                                   IOTTT
  296.           
  297.  
  298.  
  299. Purpose   To switch the (annoying) beep on or off.
  300.  
  301. Type Optional.
  302.  
  303. Declaration    IO_SoundBeeper(OK:boolean);
  304.                     
  305.           OK is true if you want the system to BEEEP when the user
  306.           presses an invalid key.
  307.  
  308. Uses CRT, FastTTT, DOS, WinTTT, KeyTTT, IOTTT.
  309.  
  310. Remarks   The default is true, i.e. the system will beep.
  311.  
  312. Example
  313.  
  314.  
  315.                USES CRT, FASTTTT, DOS, WINTTT, KEYTTT, IOTTT;
  316.                BEGIN
  317.                  IO_SOUNDBEEPER(FALSE);
  318.                END.
  319.           
  320.  
  321.  
  322.  
  323. !SHORT:IO_UserHook       Provide way to call non-Toolkit Procedure
  324. IO_UserHook                                                      IOTTT
  325.      
  326.  
  327.  
  328. NOTE This is not a procedure. IO_UserHook is declared as a pointer
  329.      variable.
  330.  
  331. Purpose   To provide a way of intercepting the input and optionally
  332.           calling a non-Toolkit procedure, i.e. a special procedure
  333.           you have written.
  334.  
  335. Type Optional
  336.  
  337. Declaration    IO_UserHook := @Procedure_Name
  338.                
  339.           Procedure_name is the actual name of the procedure which is
  340.           to be called each time a key is pressed.
  341.  
  342. Uses CRT, FastTTT, DOS, WinTTT, KeyTTT, IOTTT.
  343.  
  344. Remarks   The procedure must be declared as follows:
  345.  
  346.  
  347. Example        {$F+}
  348.                PROCEDURE_NAME(CH:CHAR; FIELDID: INTEGER; VAR RETURNSTR:
  349.                STRING);
  350.                BEGIN
  351.                .....   {STATEMENTS}
  352.                END;
  353.                {$F-}
  354.      
  355.  
  356. The compiler directives (F and F-) designate the procedure as
  357. FAR. The Procedure_Name can be any valid procedure name, and
  358. this procedure may call other procedures. The 3 procedure
  359. parameters must be defined in the order shown.
  360.                
  361. Ch will be the value of the character input by the user
  362. ,refer to appendix B for a list of the codes. Check this
  363. variable immediately and EXIT the procedure if it is not one
  364. of the special keys you are trying to intercept.
  365.                
  366. FieldID will indicate the ID of the field the user is
  367. currently editing.
  368.                
  369. ReturnStr is passed to the procedure with the current field
  370. value. You may update this variable to reset the current
  371. value of the field.
  372.  
  373. Example   See IOdem.pas on the distribution disk.
  374.