home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / menu / tcu_32a / tcu.doc < prev    next >
Encoding:
Text File  |  1991-03-26  |  84.0 KB  |  1,956 lines

  1.  
  2.  
  3.                         Turbo-C Utilities - TCU 3.2
  4.                         ===========================
  5.  
  6.  
  7. Foreword
  8. --------
  9.  
  10. Further information, support and product registration should be addressed to
  11. the address given below.
  12.  
  13.        Karl Keyte
  14.        Gross-Gerauer Strasse 10
  15.        D-6108 Weiterstadt
  16.        Germany
  17.  
  18.        Voice  :     +(49) 6150 2499
  19.        e-Mail :     KKEYTE@ESOC.BITNET
  20.        Bix    :     kkeyte
  21.  
  22. All memory models other than TINY (which is not supported) are supplied with
  23. this version.  Compilations with ALL memory models MUST use the WORD ALIGN
  24. option or else the programs WILL NOT WORK.
  25.  
  26.  
  27. If you use this product, please be sure to register by writing to the address
  28. given above.
  29.  
  30.  
  31.  
  32. Disclaimer
  33. ----------
  34.  
  35. No responsibility taken for anything which may result from using the TCU
  36. package. If anything unusual does result, please contact me on the above
  37. e-Mail address with full details.
  38.  
  39.  
  40. Introduction
  41. ------------
  42.  
  43. TCU is a library for Turbo-C v2.0 or Turbo/Borland C++ to provide a number of
  44. services relating to menus, prompt and notice windows and form entry. This
  45. document offers a full description of each of the services, their syntax
  46. and operation. The following text describes each section briefly. It is up
  47. to the user to write full test and application programs to demonstrate fully
  48. the use of each.
  49.  
  50.  
  51.    Menus
  52.    -----
  53.  
  54.    The TCU menu system offers pop-up menus and pulldown menus. Pulldown menus
  55.    utilise normal pop-up menus for each of the choices. A pop-up menu is
  56.    defined with the 'tcu_define_menu' service and may be displayed on the
  57.    screen with 'tcu_display_menu'. A choice from the menu is read with
  58.    'tcu_read_menu_selection'. The menu is removed from the screen with the
  59.    'tcu_remove_menu' service. Each menu should be declared in the calling
  60.    program as type TCU_MENU before being defined.
  61.  
  62.    A pulldown menu is a set of title options, and each option may have an
  63.    associated pop-up menu which will be displayed beneath the pulldown option
  64.    when selected.
  65.  
  66.    Items in pop-up menus may be set as 'unavailable', making that option non
  67.    selectable.  This option may be toggled on and off.
  68.  
  69.  
  70.    Prompts and Notices
  71.    -------------------
  72.  
  73.    A notice is a set of lines of text which is displayed in a notice window.
  74.    The notice must be cleared from the screen by the user pressing the RETURN
  75.    key or the ESCAPE key. A notice is initiated (though not displayed) with
  76.    the 'tcu_prepare_notice' service, and each line of text is added to the
  77.    notice using 'tcu_notice_text'. When the notice has been fully built it may
  78.    be displayed with 'tcu_display_notice'. When it is no longer needed it
  79.    should be cleared with the 'tcu_clear_notice' service.
  80.  
  81.    A prompt is simply a notice with a single input field. The input field is
  82.    defined (in colour and size) with the 'tcu_prompt_input' service. As soon
  83.    as a call to 'tcu_prompt_input' is made, the notice becomes a prompt. This
  84.    call must be made prior to the call to 'tcu_display_notice'. A prompt is
  85.    completed by the user entering the prompt field and pressing the RETURN
  86.    key.
  87.  
  88.  
  89.    Forms
  90.    -----
  91.  
  92.    The forms package is a complete form entry system allowing fixed text and
  93.    variable input areas to be defined in a form. The attributes of the form
  94.    are written in a CUF ('C' Utilities Form) file and compiled into an object
  95.    form (CFO - 'C' Form Object) or a relocatable object file using the
  96.    provided Forms Compiler. The compiler checks the syntax and validity of
  97.  
  98.  
  99.    each of the entries in the form source file, and if no errors are found the
  100.    object is generated. This object may then be loaded by an application using
  101.    the 'tcu_load_form' or 'tcu_load_image_form' service. This former gives the
  102.    application the flexibility not to depend on the exact form content which
  103.    may be modified without having to recompile or link any code (unless major
  104.    changes are made to the form structure).
  105.  
  106.    Full details of the form source syntax are available in the Forms Compiler
  107.    documentation.
  108.  
  109.    Each field in a form is addressed by its 'form id' number, which is not
  110.    specified in the form source, but is assigned at run-time. In order to
  111.    allow applications to refer to known fields, fields may be given a name
  112.    which may be used with the 'tcu_get_field_id' service to obtain the
  113.    applicable form id.
  114.  
  115.    Fields may be one of 7 types, or 6 basic types:
  116.  
  117.       Numeric   - 2 types, 1 integer and 1 floating point.
  118.       String    - Character strings
  119.       Date      - Dates in US or European format
  120.       Logical   - True/False, Yes/No, etc.
  121.       Choice    - Enumerated selection types
  122.       Button    - Selection buttons
  123.  
  124.    Fixed text within a form is declared as TEXT rather than FIELD.
  125.  
  126.    Each field or text item may be assigned a colour attribute, defining its
  127.    foreground and background colours. The COLOUR and INPUT keywords may be
  128.    used to assign default colour attributes for items not having a specific
  129.    colour attribute; this is the normal case.
  130.  
  131.    Many operations exist with the services provided to change attributes and
  132.    behaviour of the fields. These are described fully in the following text.
  133.  
  134.    Note that in the interest of retaining as much available dynamic memory as
  135.    possible for the application, forms should be unloaded after use with the
  136.    'tcu_unload_form' option. If a form is used repeatedly it is probably not
  137.    worth unloading it until the program is to terminate.
  138.  
  139.  
  140. Services
  141. --------
  142.  
  143. The following services should provide enough flexibility for you to define
  144. and use some nice little menus, prompts, notices and forms in some of your
  145. applications. If you get stuck and need an example, send some e-Mail to the
  146. above address.
  147.  
  148.   Menu Services
  149.   -------------
  150.  
  151.     tcu_change_menu_attribs          Changes colour attributes of menu
  152.     tcu_change_menu_escapes          Change valid menu escape keys
  153.     tcu_clear_menu_in_pulldown       Remove submenu of pulldown menu
  154.     tcu_define_menu                  Define a menu format
  155.     tcu_define_pulldown              Define a pulldown menu
  156.     tcu_display_pulldown_header      Display header line of pulldown
  157.     tcu_display_menu                 Display menu on screen
  158.     tcu_escape_fkey                  Find last used function key number
  159.     tcu_new_pulldown_cover           Reload screen memory under pulldown
  160.     tcu_read_menu_selection          Get user's menu choice
  161.     tcu_read_pulldown_selection      Get choice from pulldown menus
  162.     tcu_remove_menu                  Remove menu from screen
  163.     tcu_remove_pulldown              Remove pulldown menu & submenus
  164.     tcu_set_menu_help                Define help function for pulldown
  165.     tcu_set_menu_option              Enable or disable menu options
  166.     tcu_set_pulldown_help            Define help function for pulldown
  167.  
  168.  
  169.   Prompt Services
  170.   ---------------
  171.  
  172.     tcu_clear_notice                 Clear a prepared notice
  173.     tcu_display_notice               Display notice on screen
  174.     tcu_get_confirm                  Get user confirmation/rejection
  175.     tcu_notice_text                  Add line of text to prepared notice
  176.     tcu_prepare_notice               Initialise notice creation
  177.     tcu_prompt_input                 Enter an input area in a notice
  178.  
  179.   Form Services
  180.   -------------
  181.  
  182.     tcu_display_form                 Display defined form on screen
  183.     tcu_edit_form                    Interactive form edit
  184.     tcu_form_record_size             Returns the size of a form record
  185.     tcu_get_field                    Obtain field value from form
  186.     tcu_get_field_choice_string      Return the text of a Choice field
  187.     tcu_get_field_id                 Obtain numeric field ID from name
  188.     tcu_get_field_info               Obtains field information block
  189.     tcu_get_form_info                Obtains form infomation block
  190.     tcu_load_form                    Load form from .CFO form object
  191.     tcu_load_image_form              Load form from linked-in module
  192.     tcu_put_field                    Put value into form field
  193.     tcu_read_formrec                 Reads a form record from a buffer
  194.     tcu_remove_form                  Remove displayed form from screen
  195.     tcu_select_field                 Selects a field from a form
  196.     tcu_set_button_fn                Defines a form button field handler
  197.  
  198.  
  199.     tcu_set_field_attrib             Set colour attributes of field
  200.     tcu_set_field_mode               Set field characteristics
  201.     tcu_set_field_verify             Define field verification function
  202.     tcu_set_form_fnkey_fn            Establish fn. key handler for form
  203.     tcu_set_form_help                Define help function for form
  204.     tcu_set_form_mode                Set form characteristics
  205.     tcu_unload_form                  Unload form from memory
  206.     tcu_write_formrec                Writes a form record to a buffer
  207.  
  208.  
  209.   Window Services
  210.   ---------------
  211.  
  212.     tcu_change_colour                Change colours for subsequent I/O
  213.     tcu_clear_window                 Clear window and home cursor
  214.     tcu_close_window                 Remove window from screen
  215.     tcu_open_window                  Display window on screen
  216.     tcu_position_cursor              Set cursor position in window
  217.     tcu_wprintf                      Formatted window output
  218.     tcu_wgets                        Editable window input
  219.  
  220.   Miscellaneous Services
  221.   ----------------------
  222.  
  223.     tcu_colour_attrib                Get colour code for b/f colours
  224.     tcu_date_string                  Returns string form of a date type
  225.     tcu_date_value                   Returns date type of string form
  226.     tcu_get_user_keypress            Returns the last user defined key used
  227.     tcu_hash_value                   Return a hash-code for a string
  228.     tcu_restore_environment          Restores screen environment
  229.     tcu_save_environment             Saves screen environment
  230.     tcu_set_idle_loop                Establishes an idle loop handler
  231.     tcu_set_mouse_mode               Enables and disables mouse support
  232.     tcu_set_user_key_handler         Establishes an Escape/Accept key handler
  233.     tcu_warnbeep                     Produce standard TCU warning beep
  234.     _TCU_version                     Constant defining the version of TCU
  235.  
  236.  
  237.  
  238.  
  239. Mouse Support
  240. -------------
  241.  
  242. The presence of a mouse driver is detected automatically by TCU and used by
  243. default. The 'tcu_set_mouse_mode' service may be used to enable and disable
  244. the mouse.  The mouse may be used for menu option selection and form field
  245. selection. The mouse mode may be interactively toggled on and off by using
  246. the ALT-M key.
  247.  
  248.                        |     Left Button               Right Button
  249.    --------------------+----------------------------------------------------
  250.    Pulldown Menu Bar   |     Option Select             No Action
  251.    Pop-Up menu         |     Option Select             Menu Dismiss
  252.    Notices             |     Clears Notice             Clears Notice
  253.    Form Edit           |     Move to selected field.   Move to first field
  254.                        |     If button, selects it.
  255.    Field Select        |     Select Field              Move to first field
  256.    Confirmation Box    |     Confirm                   Reject
  257.  
  258.  
  259. tcu_change_colour
  260. -----------------
  261.  
  262. Function      Changes the background and foreground colours for window I/O
  263.  
  264. Syntax        #include <usr\tcu.h>
  265.               int tcu_change_colour (TCU_WINDOW *window,
  266.                                      unsigned char attribute)
  267.  
  268. Remarks       'window' defines the window to be affected. 'attribute' is the
  269.               colour attribute and may be obtained with the 'colour_attrib'
  270.               service.
  271.  
  272. Return Value  Returns TCU_OK on success, TCU_ERROR on error.
  273.  
  274.  
  275. tcu_change_menu_attribs
  276. -----------------------
  277.  
  278. Function      Changes a colour attribute of a menu. The menu must be defined
  279.               but need not be displayed.
  280.  
  281. Syntax        #include <usr\tcu.h>
  282.               int tcu_change_menu_attribs (TCU_MENU *menu,
  283.                                            int item,
  284.                                            unsigned char attribute)
  285.  
  286. Remarks       'item' identifies the attribute to change and must be one of
  287.               the following defined in 'TCU.H':
  288.  
  289.                     TCU_MENU_TITLE        Title of the menu
  290.                     TCU_MENU_BOX          Surrounding box of the menu
  291.                     TCU_MENU_OPTION       Option lines
  292.                     TCU_MENU_SELECT       Currently selected option line
  293.                     TCU_MENU_UNAVAIL      Unavailable option lines
  294.  
  295.               'attribute' describes the new colour attribute to be used for
  296.               the selected item. It may be formed by using the 'menu_attrib'
  297.               function.
  298.  
  299.               If the menu is currently displayed, the attribute will take
  300.               effect on the screen immediately.
  301.  
  302. Return Value  Returns TCU_OK if the attribute change was successful and
  303.               TCU_ERROR if an error was encountered. An error is likely to
  304.               be due to a bad item specification or an undefined menu.
  305.  
  306.  
  307. change_menu_escapes
  308. -----------------------
  309.  
  310. Function      Changes the valid escape keys for a menu.
  311.  
  312. Syntax        #include <usr\tcu.h>
  313.               int tcu_change_menu_escapes (TCU_MENU *menu,
  314.                                            unsigned char escape_keys)
  315.  
  316. Remarks       The escape keys define which keys are allowed to terminate the
  317.               interactive menu selection called with 'tcu_read_menu_selection'.
  318.               'escape_keys' is formed by logically ORing the following:
  319.  
  320.                     TCU_ESC_ESC         ESC key
  321.                     TCU_ESC_PGUP        PgUp (Page Up) key
  322.                     TCU_ESC_PGDN        PgDn (Page Down) key
  323.                     TCU_ESC_CLEFT       Left arrow key
  324.                     TCU_ESC_CRIGHT      Right arrow key
  325.                     TCU_ESC_FUNC        Function key (F2 - F12) or User Key
  326.                     TCU_ESC_CNTL_C      CNTL/C key (ASCII 3)
  327.  
  328.               The RETURN key is always a valid escape key, selecting the
  329.               currently selected menu option.
  330.  
  331.               Note that F1 is reserved for help activation.
  332.  
  333.               The TCU_ESC_FUNC mask allows either function keys or user
  334.               defined escape/accept keys to exit the menu select.
  335.  
  336. Return Value  If the escape key change was successful, TCU_OK is returned,
  337.               otherwise TCU_ERROR is returned.
  338.  
  339.  
  340. tcu_clear_menu_in_pulldown
  341. --------------------------
  342.  
  343. Function      Removes a menu which is displayed under control of a pulldown
  344.               menu line.
  345.  
  346. Syntax        #include <usr\tcu.h>
  347.               int tcu_clear_menu_in_pulldown (TCU_PULLDOWN *pmenu);
  348.  
  349. Remarks       This service should be used when a pop-up menu displayed under
  350.               control of a pulldown menu is to be removed from the screen.
  351.               Do not try to call 'tcu_remove_menu' directly as the pulldown
  352.               menu will become inconsistent with what is on the screen.
  353.  
  354. Return Value  TCU_OK if the call was successful, otherwise TCU_ERROR.
  355.  
  356.  
  357. tcu_clear_notice
  358. ----------------
  359.  
  360. Function      Removes a notice/prompt definition from memory.
  361.  
  362. Syntax        #include <usr\tcu.h>
  363.               int tcu_clear_notice (TCU_NOTICE *notice)
  364.  
  365. Remarks       The definition of a notice or prompt is removed with the
  366.               call to 'tcu_clear notice'. An intervening 'tcu_prepare_notice'
  367.               call is required before using 'tcu_display_notice'.
  368.  
  369. Return Value  Returns TCU_OK if the service was executed successfully,
  370.               otherwise TCU_ERROR is returned.
  371.  
  372.  
  373. tcu_clear_window
  374. ----------------
  375.  
  376. Function      Clears the window and homes the cursor.
  377.  
  378. Syntax        #include <usr\tcu.h>
  379.               int tcu_clear_window (TCU_WINDOW *window)
  380.  
  381. Remarks       The window is cleared with the currently active background
  382.               colour. The cursor is relocated to (1,1) relative to the
  383.               window.
  384.  
  385. Return Value  Returns TCU_OK on success, TCU_ERROR on error.
  386.  
  387.  
  388. tcu_close_window
  389. ----------------
  390.  
  391. Function      Close and remove a window from the screen.
  392.  
  393. Syntax        #include <usr\tcu.h>
  394.               int tcu_close_window (TCU_WINDOW *window)
  395.  
  396. Remarks       The window is removed from the screen, the old screen contents
  397.               restored and the window memory is released to the system.
  398.  
  399. Return Value  Returns TCU_OK on success, TCU_ERROR on error.
  400.  
  401.  
  402. tcu_colour_attrib
  403. -----------------
  404.  
  405. Function      Forms a colour attribute from the foreground and background
  406.               colour attributes.
  407.  
  408. Syntax        #include <usr\tcu.h>
  409.               unsigned char tcu_colour_attrib (int foreground,
  410.                                                int background)
  411.  
  412. Remarks       'tcu_colour_attrib' may be used to form the colour attribute
  413.               required by other menu and notice services. 'background' and
  414.               'foreground' represent the foreground colour and background
  415.               background colour respectively. Any colour defined in 'conio.h'
  416.               may be used if it is valid with the hardware being used.
  417.  
  418.               The standard symbol BLINK may be added to the foreground colour
  419.               to obtain a blinking foreground.
  420.  
  421. Return Value  Returns a compound colour attribute code.
  422.  
  423.  
  424. tcu_date_string
  425. ---------------
  426.  
  427. Function      Obtains the character string representation of a date value.
  428.  
  429. Syntax        #include <usr\tcu.h>
  430.               char *tcu_date_string (unsigned short date,
  431.                                      unsigned char presentation);
  432.  
  433. Remarks       Returns a pointer to a static string buffer of 8 characters
  434.               which is overwritten with each call. 'date' specifies the
  435.               date value, i.e. val.v_date of TCU_FIELD_VALUE. 'presentation'
  436.               specifies either TCU_FLD_DAYFIRST or TCU_FLD_MONTHFIRST.
  437.  
  438. Return Value  Returns a pointer to the static date string data.
  439.  
  440.  
  441. tcu_date_value
  442. --------------
  443.  
  444. Function      Returns a date type of a character date string.
  445.  
  446. Syntax        #include <usr\tcu.h>
  447.               unsigned short tcu_date_value (char *date,
  448.                                              unsigned char presentation);
  449.  
  450. Remarks       Returns the date value of type val.v_date of TCU_FIELD_VALUE for
  451.               the specified string 'date'. 'presentation' specifies either
  452.               TCU_FLD_DAYFIRST or TCU_FLD_MONTHFIRST.
  453.  
  454. Return Value  Returns the date type.
  455.  
  456.  
  457. tcu_define_menu
  458. ---------------
  459.  
  460. Function      Establish a definition for a menu, comprising characteristics
  461.               and content.
  462.  
  463. Syntax        #include <usr\tcu.h>
  464.               int tcu_define_menu (TCU_MENU *menu,
  465.                                    char *title,
  466.                                    unsigned char title_attrib,
  467.                                    unsigned char box_attrib,
  468.                                    unsigned char option_attrib,
  469.                                    unsigned char select_attrib,
  470.                                    unsigned char unavail_attrib,
  471.                                    unsigned char escape_keys,
  472.                                    unsigned char box_type,
  473.                                    char *options[],
  474.                                    unsigned char hot_key_attrib)
  475.  
  476. Remarks       Uses the user declared element 'menu' to build a menu prototype
  477.               for subsequent menu functions.  'menu' is the address of a MENU
  478.               type.  It is initialised with the call to define_menu and used
  479.               in subsequent menu functions.  'title' is an optional title for
  480.               the menu which, if present, will be displayed in the menu header
  481.               line.  'title_attrib' defines the colour attributes of the title
  482.               of the menu.  'box_attrib' defines the attributes of the menu
  483.               border.  'option_attrib' defines the attributes of the choices
  484.               of the menu.  'select_attrib' defines the attributes of the
  485.               currently selected menu option.  'unavail_attrib' defines the
  486.               attributes of menu options currently unavailable.  'escape_keys'
  487.               defines the set of keys permitted to exit from the menu select.
  488.               'box_type' defines the type of the surrounding menu box.
  489.  
  490.               The attributes may be formed by using the function 'menu_attrib'
  491.               which builds the attribute byte.  The two parameters are
  492.               foreground colour and background colour, and the return value
  493.               is of type attribute, i.e. unsigned char.
  494.  
  495.               'escape_keys' is formed by logically ORing the following,
  496.               depending on which should be permitted to exit the menu choice.
  497.               The RETURN key is always valid for actively selecting the
  498.               current choice.
  499.  
  500.                     TCU_ESC_ESC         ESCAPE key
  501.                     TCU_ESC_PGUP        Page Up key
  502.                     TCU_ESC_PGDN        Page Down key
  503.                     TCU_ESC_CLEFT       Left arrow key
  504.                     TCU_ESC_CRIGHT      Right arrow key
  505.                     TCU_ESC_FUNC        An unshifted function key F2 - F12
  506.                     TCU_ESC_CNTL_C      The CNTL/C key (ASCII 3)
  507.  
  508.               Note that F1 is reserved for help activation.
  509.  
  510.               'box_type' defines whether the box is singly or doubly lined
  511.               and is one of the following:
  512.  
  513.                     TCU_BOX_SINGLE      Single line surround
  514.                     TCU_BOX_DOUBLE      Double line surround
  515.                     TCU_BOX_BLANK       Surrounded by blank spaces
  516.  
  517.               'options' is a pointer to an array of the character strings
  518.               defining the menu choices. If 'hot_key_attrib' is non-zero
  519.               it should be a valid colour attribute used to display the
  520.               hot key character of a menu selection. When hot keys are
  521.               used, the FIRST character of each of the menu option strings
  522.               should be used to identify the character occurring in the rest
  523.               of the option string which is to be used as the hot key. E.g.,
  524.               the string "PDisPlay Customer" would use 'P' as the hot-key.
  525.               Note that only the first character matching the hot-key may
  526.               be used. If 'hot_key_attrib' is zero, no hot-keys will be
  527.               used at all.
  528.  
  529. Return Value  define_menu returns TCU_OK if the call was successful or
  530.               TCU_ERROR if an error was detected in the processing.
  531.  
  532.  
  533. tcu_define_pulldown
  534. -------------------
  535.  
  536. Function      Defines a pulldown menu ready for display and activation.
  537.  
  538. Syntax        #include <usr\tcu.h>
  539.               int tcu_define_pulldown (TCU_PULLDOWN *pmenu,
  540.                                        unsigned char line_colour,
  541.                                        unsigned char option_colour,
  542.                                        unsigned char select_colour,
  543.                                        char *titles[],
  544.                                        unsigned char hot_key_attrib,
  545.                                        TCU_MENU *menus[]);
  546.  
  547. Remarks       Defines a pulldown menu. 'pmenu' specifies the menu to be
  548.               defined, and should be declared by the caller. 'line_colour',
  549.               'option_colour' and 'select_colour' specify the colours of the
  550.               pulldown header line, the title texts and the currently selected
  551.               title respectively. The function 'tcu_colour_attrib' may be used
  552.               to obtain the compound colour codes for these colours.
  553.  
  554.               'titles' is an array of strings which contain the titles used
  555.               in the header line. This list must be terminated with a NULL
  556.               pointer. If 'hot_key_attrib' is non-zero it should be a valid
  557.               colour attribute used to display the hot key character of a
  558.               pulldown menu selection. When hot keys are used, the FIRST
  559.               character of each of the title strings should be used to
  560.               identify the character occurring in the rest of the title
  561.               string which is to be used as the hot key. E.g., the string
  562.               "fConfiguration Menu" would use 'f' as the hot-key and will
  563.               highlight that character with the specified attributes in
  564.               the title when not selected. Note that only the first character
  565.               matching the hot-key may be used. If 'hot_key_attrib' is zero,
  566.               no hot-keys will be used at all.
  567.  
  568.               'menus' is a pointer to an array of menus. These menus are
  569.               normal menus defined with 'tcu_define_menu', and may also be
  570.               used outside the control of the pulldown menu.  Note that if a
  571.               pulldown menu title is to have no associated menu, the pointer
  572.               in that position should contain NULL.
  573.  
  574. Return Value  Returns TCU_OK if the definition was successful, otherwise
  575.               returns TCU_ERROR.
  576.  
  577.  
  578. tcu_display_form
  579. ----------------
  580.  
  581. Function      Displays a loaded form on the screen.
  582.  
  583. Syntax        #include <usr\tcu.h>
  584.               int tcu_display_form (TCU_FORM *form,
  585.                                     int x_pos,
  586.                                     int y_pos)
  587.  
  588. Remarks       The form to be displayed must have been loaded with a call
  589.               to 'tcu_load_form'. 'form' specifies the address of a form
  590.               object. 'x_pos' and 'y_pos' specify the top-left corner of
  591.               the form. It is the callers responsibility to ensure that
  592.               the form to be displayed has room on the screen for the
  593.               specified position.
  594.  
  595. Return Value  Returns TCU_OK is successful, otherwise TCU_ERROR.
  596.  
  597.  
  598. tcu_display_menu
  599. ----------------
  600.  
  601. Function      Uses a predefined menu to display the menu on the screen
  602.               ready for interactive selection.
  603.  
  604. Syntax        #include <usr\tcu.h>
  605.               int tcu_display_menu (TCU_MENU *menu,
  606.                                     int x_pos,
  607.                                     int y_pos)
  608.  
  609. Remarks       Displays a menu on the screen.  No waiting for user input is
  610.               performed; the menu is displayed and control returns to the
  611.               caller.
  612.  
  613.               'menu' is the address of a MENU type initialised with the
  614.               'tcu_define_menu' service.  'x_pos' and 'y_pos' define the
  615.               screen position of the top-left corner of the menu.  Note that
  616.               the top-left corner of the screen is (1, 1).
  617.  
  618. Return Value  The service returns TCU_OK if the menu was successfully
  619.               displayed and TCU_ERROR if an error condition was encountered.
  620.  
  621.  
  622. tcu_display_notice
  623. ------------------
  624.  
  625. Function      Displays a notice or prompt on the screen.
  626.  
  627. Syntax        #include <usr\tcu.h>
  628.               int tcu_display_notice (TCU_NOTICE *notice,
  629.                                       int x_pos,
  630.                                       int y_pos)
  631.  
  632. Remarks       The notice/prompt is displayed with the top-left corner at
  633.               the position specified by 'x_pos' and 'y_pos'. If the notice
  634.               includes a prompt field, it may be interactively edited after
  635.               this call. The completion of a prompt input completes this
  636.               service and removes the prompt from the screen (though does
  637.               not remove its definition from memory until a call to the
  638.               'tcu_clear_notice' service. If the notice contains no prompt
  639.               input the user must press to RETURN key, the ESC key or a mouse
  640.               button to complete the call.
  641.  
  642.               Note that with prompts, if the input field returns with a
  643.               length of -1, the user cancelled the input with the ESC key.
  644.               Since the length is a character type the caller must be sure
  645.               that the test against -1 is performed as a 'signed char' test,
  646.               either by using default signed characters, casting or testing
  647.               against the value 0xFF rather than -1.
  648.  
  649. Return Value  TCU_OK if successful, else TCU_ERROR.
  650.  
  651.  
  652. tcu_display_pulldown_header
  653. ---------------------------
  654.  
  655. Function      Displays the header line of a pulldown menu without waiting for
  656.               a selection.
  657.  
  658. Syntax        #include <usr\tcu.h>
  659.               int tcu_display_pulldown_header (TCU_PULLDOWN *pulldown)
  660.  
  661. Remarks       The header line for the pulldown menu 'pulldown' is displayed.
  662.               The pulldown menu must already have been defined. The function
  663.               is exactly as 'tcu_read_pulldown_selection' without the actual
  664.               selection of an item.
  665.  
  666. Return Value  Returns TCU_OK if successful, else TCU_ERROR.
  667.  
  668.  
  669. tcu_edit_form
  670. -------------
  671.  
  672. Function      Interactively edit a loaded and displayed form.
  673.  
  674. Syntax        #include <usr\tcu.h>
  675.               int tcu_edit_form (TCU_FORM *form,
  676.                                  int start_field_id,
  677.                                  int *keypress)
  678.  
  679. Remarks       The form may be interactively edited using the form and field
  680.               attributes and characteristics that exist at the time of the
  681.               call. 'form' specifies the address of a form object. The start
  682.               field-ID may be specified with 'start_field_id'. If set to 1,
  683.               the first valid field will be used. 'keypress' specifies the
  684.               address of an integer which will indicate the key used to escape
  685.               from the form input. 'keypress' will be one of the following
  686.               symbols:
  687.  
  688.                 TCU_FLD_ESCESC      ESCAPE key used to quit
  689.                 TCU_FLD_ESCCNTL     CNTL/C key used to abort
  690.                 TCU_FLD_FNKEYESC    ESCAPE requested from function key handler
  691.                 TCU_FLD_BUTTONESC   ESCAPE requested from button handler
  692.                 TCU_FLD_ESCPGUP     PgUp key
  693.                 TCU_FLD_ESCPGDN     PgDn key
  694.                 TCU_FLD_FNKEYSAVE   PgUp requested from function key handler
  695.                 TCU_FLD_BUTTONSAVE  PgUp requested from button handler
  696.  
  697.               The first four codes reflect that the form was exited abnormally
  698.               and the field values remain as they were before the edit. The
  699.               latter four are normal returns, and the form will have been
  700.               updated to reflect the edits made. If the form has been set to
  701.               'no escape keys' mode with 'tcu_set_form_mode' and the
  702.               TCU_FORM_NOESCS parameter, only the button and function keys
  703.               returns will be returned as the keyboard escape keys are blocked
  704.               at a lower level.
  705.  
  706.               NOTE: Editing keys in a form are as follows:
  707.  
  708.                     ->          : Move right one character
  709.                     <-          : Move left one character
  710.                     Up Arrow    : Move to previous field
  711.                     Down Arrow  : Move to next field
  712.                     Home        : Move to first character in field
  713.                     End         : Move to last character in field
  714.                     CNTL PgUp   : Move to first field in form
  715.                     CNTL PgDn   : Move to last field in form
  716.                     F1          : Help
  717.                     CNTL Home   : Restore contents of field as when entered
  718.                     CNTL End    : Clear field
  719.                     INSERT      : Toggle insert mode
  720.                     BACKSPACE   : Delete character to the left of the cursor
  721.                     Del         : Delete character under the cursor
  722.                     ESC         : Escape (cancel) form edit
  723.                     CNTL/C      : Escape (abort) form edit
  724.                     PgUp        : Accept form edit
  725.                     PgDn        : Accept form edit
  726.  
  727. Return Value  TCU_OK if the edit was successful, otherwise TCU_ERROR.
  728.  
  729.  
  730. tcu_escape_fkey
  731. ---------------
  732.  
  733. Function      Returns the last function key number used to escape a menu.
  734.  
  735. Syntax        #include <usr\tcu.h>
  736.               int tcu_escape_fkey (void)
  737.  
  738. Remarks       If the function key escape mode is enabled, i.e., the option
  739.               TCU_MENU_FUNC is set in the escape keys of the menu, and the
  740.               menu was terminated with a FN key ('tcu_read_menu_selection'
  741.               returned -TCU_ESC_FUNC), 'tcu_escape_fkey' will return the
  742.               function key used to leave the menu.
  743.  
  744. Return Value  Returns 0 if no function key has been used, otherwise the
  745.               number of the function key, 1 = F2, 2 = F2, etc. 12 is the
  746.               last function key used. Keys F11 and F12 on may only be used
  747.               on machines with BIOS support for extended keyboards. Note that
  748.               the F1 key is reserved for activation of a user defined help
  749.               function.
  750.  
  751.  
  752. tcu_form_record_size
  753. --------------------
  754.  
  755. Function      Obtains the size in bytes of a complete form record.
  756.  
  757. Syntax        #include <usr\tcu.h>
  758.               int tcu_form_record_size (TCU_FORM *form)
  759.  
  760. Remarks       This service is used to obtain the size of a buffer required
  761.               to hold the fields of a complete form.  It is normally used
  762.               in conjunction with the 'tcu_read_formrec' service and the
  763.               'tcu_write_formrec' service.
  764.  
  765. Return Value  Returns the size in bytes of a complete form record or -1 if
  766.               an error was encountered.
  767.  
  768.  
  769. tcu_get_confirm
  770. ---------------
  771.  
  772. Function      Queries the user for confirmation or rejection
  773.  
  774. Syntax        #include <usr\tcu.h>
  775.               int tcu_get_confirm (int x,
  776.                                    int y,
  777.                                    unsigned char box_attrib,
  778.                                    unsigned char text_attrib,
  779.                                    char *text,
  780.                                    ...)
  781.  
  782. Remarks       Queries the user for confirmation of the 'text' which is
  783.               displayed in a box with colour attributes 'box_attrib' at
  784.               position (x,y). The text is displayed with attributes
  785.               'text_attrib'. The user may enter 'y', 'Y', 'n', 'N' or a
  786.               mouse button (left = confirm, right = reject) to confirm or
  787.               reject. 
  788.  
  789.               If the confirmation box would lie outside the screen area,
  790.               the confirmation text is changed automatically to the string
  791.               "Confirm (Y,N)?" and placed in the upper-left corner of the
  792.               screen.
  793.  
  794. Return Value  Returns 0 for rejection or 1 for confirmation.
  795.  
  796.  
  797. tcu_get_field
  798. -------------
  799.  
  800. Function      Obtains a value for a form field.
  801.  
  802. Syntax        #include <usr\tcu.h>
  803.               int tcu_get_field (TCU_FORM *form,
  804.                                  int field,
  805.                                  TCU_FIELD_VALUE *val)
  806.  
  807. Remarks       'form' specifies the form object. 'field' is the field ID of
  808.               the field of which the value is to be obtained. 'val' is the
  809.               address of a TCU_FIELD_VALUE type object. The field value is a
  810.               structure which must be addressed according to the type of the
  811.               field (which should be known by the caller). The fields of the
  812.               structure are:
  813.  
  814.                         v_int        : 32-bit signed integer for integers
  815.                         v_float      : 64-bit floating value for real types
  816.                         v_string     : Pointer to the string value
  817.                         v_date       : 16-bit integer coded date
  818.                         v_logical    : 8-bit data, 0 = FALSE, 1 = TRUE
  819.                         v_choice.sel : 16-bit integer enumerated pointer
  820.  
  821.               String values are copied into the user's calling address. This
  822.               means that 'v_string' should be set to point at the address
  823.               where the string is to be received. Failing to do this will
  824.               use a default pointer and will probably end in tears!
  825.  
  826.               Date types represent the number of days since the start of the
  827.               19th century. This need not be known, though may be useful to
  828.               know that arithmetic operations on these types will represent
  829.               days.
  830.  
  831.               Choice types are addressed using the sub-element 'v_choice.sel'
  832.               which is an index into the list of choices. I.e. 1 represents
  833.               the first selection, 2 the second, etc. 'v_choice.max' contains
  834.               the maximum valid index for the choice selection, though this
  835.               must not be modified by the application.
  836.  
  837. Return Value  TCU_OK if the field was returned successfully, else TCU_ERROR.
  838.  
  839.  
  840. tcu_get_field_choice_string
  841. ---------------------------
  842.  
  843. Function      Obtains the text string associated with a field of 'Choice'
  844.               type.
  845.  
  846. Syntax        #include <usr\tcu.h>
  847.               int tcu_get_field_choice_string (TCU_FORM *form,
  848.                                                int field,
  849.                                                char *string);
  850.  
  851. Remarks       'form' specifies the form where field 'field' resides. The
  852.               field must be of type 'Choice' or the call will fail. The
  853.               string associated with the current selection will be placed
  854.               at the address specified as 'string'.
  855.  
  856. Return Value  Returns TCU_OK if the call was successful, else TCU_ERROR.
  857.  
  858.  
  859. tcu_get_field_id
  860. ----------------
  861.  
  862. Function      Obtains the field ID for a named field.
  863.  
  864. Syntax        #include <usr\tcu.h>
  865.               int tcu_get_field_id (TCU_FORM *form,
  866.                                     char *field_name,
  867.                                     int *field_id)
  868.  
  869. Remarks       Fields in forms may optionally be named. This allows the caller
  870.               to use meaningful names for fields rather than have to know
  871.               the logical field ID. 'form' identifies the form object,
  872.               'field_name' points to the name of the field for which the ID
  873.               is required. Case is NOT significant. 'field_id' points to the
  874.               integer into which the ID will be written. This may then be used
  875.               for subsequent field related operations. If 'field_id' is NULL,
  876.               it is not used.
  877.  
  878. Return Value  Returns the ID of the field if present, else 0 if either an
  879.               error occurred or the field was not found.
  880.  
  881.  
  882. tcu_get_field_info
  883. ------------------
  884.  
  885. Function      Fills a struture with information about the specified field
  886.  
  887. Syntax        #include <usr\tcu.h>
  888.               int tcu_get_field_info (TCU_FORM *form,
  889.                                       int field_id,
  890.                                       TCU_FIELD_INFO *info);
  891.  
  892. Remarks       The function fills the user-declared structure 'info' with
  893.               information about field 'field_id' in form 'form'. The structure
  894.               has the following fields:
  895.  
  896.               typedef struct {                 
  897.                  char           name[9];       /* Field name */
  898.                  unsigned char  type,          /* Type of field */
  899.                                 size,          /* Width of field on screen */
  900.                                 decimal,       /* Decimal places if numeric */
  901.                                 present,       /* Presentation form of data */
  902.                                 xpos,          /* Window x-coordinate */
  903.                                 ypos,          /* Window y-coordinate */
  904.                                 usemin,        /* 1 if minimum range active */
  905.                                 usemax,        /* 1 if maximum range active */
  906.                                 useval,        /* 1 if initial value used */
  907.                                 usetmp;        /* 1 if string template used */
  908.                  union {
  909.                     struct {
  910.                        long     min,           /* Minimum value */
  911.                                 max;           /* Maximum value */
  912.                     } i;
  913.                     struct {
  914.                        double   min,           /* Minimum value */
  915.                                 max;           /* Maximum value */
  916.                     } f;        
  917.                     struct {
  918.                        unsigned short   min,   /* Minimum value */
  919.                                         max;   /* Maximum value */
  920.                     } d;
  921.                  } range;
  922.                  unsigned char  colour;        /* Colour attributes */
  923.                  struct {
  924.                     unsigned int  ronly : 1,   /* Read only flag */
  925.                                   noecho : 1,  /* No-echo input flag */
  926.                                   fixtext : 1, /* Fixed text field flag */
  927.                                   param : 1,   /* Non-editable variable field */
  928.                                   confirm : 1; /* ENTER confirmation needed flag */
  929.                  } attr;          
  930.                  TCU_FIELD_VALUE      val;         /* Value of field */
  931.               } TCU_FIELD_INFO;
  932.  
  933.               The fields in this structure represent the current state of the
  934.               form field. Use this service to obtain information about a field
  935.               rather than trying to access the field directly through the form
  936.               structure.
  937.  
  938. Return Value  Returns TCU_OK if the field information was obtained without
  939.               error, else returns TCU_ERROR.
  940.  
  941.  
  942. tcu_get_form_info
  943. -----------------
  944.  
  945. Function      Fills a structure with information about the specified form
  946.  
  947. Syntax        #include <usr\tcu.h>
  948.               int tcu_get_form_info (TCU_FORM *form,
  949.                                      TCU_FORM_INFO *info);
  950.  
  951. Remarks       The function fills the user-declared structure 'info' with
  952.               information about form 'form'. The structure has the following
  953.               fields:
  954.  
  955.               typedef struct {
  956.                  unsigned int   num_fields;    /* Number of fields */
  957.                  char          *title;         /* Title string of form */
  958.                  unsigned char  text_colour,   /* Colour attribute */
  959.                                 field_colour,  /* Input field colour default */
  960.                                 title_colour,  /* Title string colour */
  961.                                 edit_colour,   /* Colour of field under edit */
  962.                                 xpos,          /* x-coordinate on screen */
  963.                                 ypos,          /* y-coordinate on screen */
  964.                                 height,        /* Height of form */
  965.                                 width,         /* Width of form */
  966.                                 box_type,      /* Form surround type */
  967.                                 mode,          /* Flags whether in use/displayed */
  968.                                 verify_fn,     /* 1 if verify function active */
  969.                                 help_fn,       /* 1 if help function active */
  970.                                 fn_key_fn;     /* 1 if fn. key handler active */
  971.                                 button_fn;     /* 1 if button select handler */
  972.                  struct {
  973.                     unsigned int  ronly : 1,   /* Form is read only */
  974.                                   no_esc : 1;  /* Escape keys disabled */
  975.                  } attr;
  976.               } TCU_FORM_INFO;
  977.  
  978.               The fields in this structure represent the current state of the
  979.               form. Use this service to obtain information about the form
  980.               rather than trying to access the information directly through
  981.               the form structure.
  982.  
  983. Return Value  Returns TCU_OK if no error was encountered, else FORK_ERROR.
  984.  
  985.  
  986. tcu_get_user_keypress
  987. ---------------------
  988.  
  989. Function      Returns the last used user defined key
  990.  
  991. Syntax        #include <usr\tcu.h>
  992.               unsigned short tcu_get_user_keypress (void)
  993.  
  994. Remarks       The function is used with the user key handler (set with the
  995.               'tcu_set_user_key_handler' service) to return the actual
  996.               scancode of the last user defined key used.  A user defined
  997.               key is one which is processed with a user key handler and not
  998.               ignored, i.e. the handler does not return 0.
  999.  
  1000. Return Value  User key scancode or 0 if no user key has been used.
  1001.  
  1002.  
  1003. tcu_hash_value
  1004. --------------
  1005.  
  1006. Function      Returns a hash value associated with a string
  1007.  
  1008. Syntax        #include <usr\tcu.h>
  1009.               unsigned long tcu_hash_value (char *string,
  1010.                                             unsigned long range)
  1011.  
  1012. Remarks       This function calculates and returns a hash value for a given
  1013.               string between 0 and range-1.  The hash value may be used to
  1014.               index a table for data retrieval purposes.
  1015.  
  1016. Return Value  Returns the hash value.
  1017.  
  1018.  
  1019. tcu_load_form
  1020. -------------
  1021.  
  1022. Function      Loads a form from the .CFO form object file into a form object.
  1023.  
  1024. Syntax        #include <usr\tcu.h>
  1025.               int tcu_load_form (TCU_FORM *form,
  1026.                                  char *filename)
  1027.  
  1028. Remarks       This function operates on form object files which are produced
  1029.               from the .CUF source files by the forms compiler.  Form objects
  1030.               normally have the type .CFO.  'form' identifies the form object
  1031.               into which the form is to be loaded. 'filename' specifies the
  1032.               name of the object file.  See the forms compiler documentation
  1033.               for further details and a description of the source file format.
  1034.  
  1035. Return Value  Returns TCU_OK if the form was loaded successfully, else
  1036.               TCU_ERROR. TCU_ERROR will normally indicate an internal error
  1037.               such as memory allocation problems, though it is possible that a
  1038.               range error in date fields was invalidated.  For example, if a
  1039.               field was specified in the .CUF source file as:
  1040.  
  1041.                  FIELD = @10,10; Date (MonthFirst); Range (Today, 12/31/90)
  1042.  
  1043.               then an error will occur trying to load this on or after the
  1044.               date 12/31/90 as the range is invalidated.
  1045.  
  1046.  
  1047. tcu_load_image_form
  1048. -------------------
  1049.  
  1050. Function      Loads a form from a form image linked with the application.
  1051.  
  1052. Syntax        #include <usr\tcu.h>
  1053.               extern TCU_FORM FORM_IMAGE;
  1054.               int tcu_load_image_form (TCU_FORM *form,
  1055.                                        TCU_FORM *FORM_IMAGE)
  1056.  
  1057. Remarks       This function is directly equivalent to 'tcu_load_form', only it
  1058.               loads forms internally from object modules linked in with the
  1059.               application. 'form' specifies the form object with which the
  1060.               form will later be addressed. 'FORM_IMAGE' specifies the
  1061.               external form image data which should be declared elsewhere as a
  1062.               type of 'extern TCU_FORM FORM_IMAGE'. This service offers the
  1063.               advantage over the 'tcu_load_form' service that an application
  1064.               may be completely self-contained with no external form files to
  1065.               supply. A disadvantage is that the application must be relinked
  1066.               if the form definition changes. Use the /OBJECT or /LOADNAME
  1067.               options of the forms compiler to generate linkable object
  1068.               modules instead of the normal object files. 'FORM_IMAGE' is the
  1069.               loadname of the object module which defaults to the file name
  1070.               part of the original .CUF form definition file, but may be
  1071.               specified using the /LOADNAME option of the forms compiler.
  1072.  
  1073. Return Value  See 'tcu_load_form'
  1074.  
  1075.  
  1076. tcu_new_pulldown_cover
  1077. ----------------------
  1078.  
  1079. Function      Reloads the saved screen cover under pulldown menus.
  1080.  
  1081. Syntax        #include <usr\tcu.h>
  1082.               int tcu_new_pulldown_cover (TCU_PULLDOWN *pmenu);
  1083.  
  1084. Remarks       This service should be used when the screen is changed outside
  1085.               the control of a pulldown menu but while the menu is displayed.
  1086.               This ensures that the further manipulation of the screen by the
  1087.               pulldown menu services will result in a consistent display.
  1088.               'pmenu' specifies the pulldown menu object.
  1089.  
  1090. Return Value  TCU_OK is successful, else TCU_ERROR.
  1091.  
  1092.  
  1093. tcu_notice_text
  1094. ---------------
  1095.  
  1096. Function      Formats a string for inclusion in the body of a notice or
  1097.               prompt.
  1098.  
  1099. Syntax        #include <usr\tcu.h>
  1100.               int tcu_notice_text (TCU_NOTICE *notice,
  1101.                                    char *fmt, ...)
  1102.  
  1103. Remarks       The parameter list is identical to that of the 'printf'
  1104.               function, and any valid 'printf' format control facilities may
  1105.               be used with the exception of control codes such as '\n' and
  1106.               '\b'. Blank lines are obtained by using an empty string, as in
  1107.  
  1108.                    status = notice_text (&my_notice, "");
  1109.  
  1110.               Each call to 'tcu_notice_text' represents a line in the notice
  1111.               or prompt. The size of the notice is automatically computed to
  1112.               allow the longest line registered with 'tcu_notice_text'.
  1113.  
  1114. Return Value  TCU_OK if the call was successful, else TCU_ERROR.
  1115.  
  1116.  
  1117. tcu_open_window
  1118. ---------------
  1119.  
  1120. Function      Opens a window and displays it on the screen.
  1121.  
  1122. Syntax        #include <usr\tcu.h>
  1123.               int tcu_open_window (TCU_WINDOW *window,
  1124.                                    int xpos, int ypos,
  1125.                                    int xsize, int ysize,
  1126.                                    char *title,
  1127.                                    unsigned char box_attrib,
  1128.                                    unsigned char window_attrib,
  1129.                                    unsigned char title_attrib,
  1130.                                    unsigned char box_type);
  1131.  
  1132. Remarks       Opens a window of outside size 'xsize' x 'ysize' characters at
  1133.               location (xpos,ypos). 'title' defines a textual title to appear
  1134.               in the header line of the window, or may be omited by either
  1135.               specifying NULL or a zero length string. 'box_attrib',
  1136.               'window_attrib' and 'title_attrib' define the colour attributes
  1137.               of the surrounding box, the window body and the title text
  1138.               respectively. 'box_type' is one of:
  1139.  
  1140.                     TCU_BOX_SINGLE      Single line surround
  1141.                     TCU_BOX_DOUBLE      Double line surround
  1142.                     TCU_BOX_BLANK       Surrounded by blank spaces
  1143.  
  1144.               The user declared entity 'window' is filled with the initalised
  1145.               window data and passed to subsequent windowing services.
  1146.  
  1147.               Note that the window ALWAYS has a one character border, and the
  1148.               size is including this border. A window of size 40 x 10 will
  1149.               have a usable size 38 x 8, and this will be the maximum
  1150.               cursor address. (1,1) always represents the top-left corner of
  1151.               USABLE window space.
  1152.  
  1153. Return Value  Returns TCU_OK on success, TCU_ERROR on error. An error will
  1154.               normally be the result of specifying bad parameters or a memory
  1155.               overflow. Bad parameters will often be caused by specifying
  1156.               part of the window to be out of range of the screen.
  1157.  
  1158.  
  1159. tcu_position_cursor
  1160. -------------------
  1161.  
  1162. Function      Moves a window cursor to a specified point in the window.
  1163.  
  1164. Syntax        #include <usr\tcu.h>
  1165.               int tcu_position_cursor (TCU_WINDOW *window,
  1166.                                        int x, int y)
  1167.  
  1168. Remarks       Moves the cursor to the specified location in the window.
  1169.  
  1170. Return Value  Returns TCU_OK on success, TCU_ERROR on error. An error will
  1171.               normally be attributable to an attempt to move the cursor
  1172.               outside the window area.
  1173.  
  1174.  
  1175. tcu_prepare_notice
  1176. ------------------
  1177.  
  1178. Function      Initialises a notice/prompt.
  1179.  
  1180. Syntax        #include <usr\tcu.h>
  1181.               int tcu_prepare_notice (TCU_NOTICE *notice,
  1182.                                       char *title,
  1183.                                       unsigned char title_colour,
  1184.                                       unsigned char box_colour,
  1185.                                       unsigned char notice_colour,
  1186.                                       unsigned char box_type)
  1187.  
  1188. Remarks       A notice or prompt is initialised with this service. The
  1189.               parameters 'box_colour', 'notice_colour' and 'title_colour'
  1190.               specify the colours of the surrounding box, the main notice
  1191.               panel and the title string respectively. 'box_type' is one of
  1192.               the following and defines the form of the perimeter box:
  1193.  
  1194.                    TCU_BOX_SINGLE          : Single lined box
  1195.                    TCU_BOX_DOUBLE          : Double lined box
  1196.                    TCU_BOX_BLANK           : Surrounded by blank spaces
  1197.  
  1198.               Text may be added to the notice with the 'tcu_notice_text'
  1199.               service and the notice become complete at the call to
  1200.               'tcu_display_notice'. When the notice has been removed by the
  1201.               user, it remains defined until a 'tcu_clear_notice' call is
  1202.               made. This allows a notice to be used more than once without
  1203.               redefinition.
  1204.  
  1205.               If no title is to be used, it should be specified as "", i.e.
  1206.               an empty string.  In this case the 'title_colour' parameter is
  1207.               ignored.
  1208.  
  1209. Return Value  Returns TCU_OK if successful, else TCU_ERROR.
  1210.  
  1211.  
  1212. tcu_prompt_input
  1213. ----------------
  1214.  
  1215. Function      Adds an input field area to a notice.
  1216.  
  1217. Syntax        #include <usr\tcu.h>
  1218.               int tcu_prompt_input (TCU_NOTICE *notice,
  1219.                                     int xpos,
  1220.                                     int ypos,
  1221.                                     char *buffer,
  1222.                                     unsigned char prompt_colour)
  1223.  
  1224. Remarks       Only one input field may be present in a notice. If an input
  1225.               field is specified, the notice becomes a 'prompt'. 'xpos' and
  1226.               'ypos' specify the start position of the input area in the
  1227.               notice panel. 'buffer' is a pointer to a user area where the
  1228.               input is to be put. 'buffer' has the same form as the buffer
  1229.               used in the library function 'cgets', i.e. buffer[0] must
  1230.               specify the maximum length of the input field, and the actual
  1231.               data is returned from buffer[2]. buffer[1] contains the number
  1232.               of characters in the input field. This means 'buffer' must be
  1233.               large enough to hold the maximum input string + 3 (to include
  1234.               buffer[0], buffer[1] and the terminating '\0'. When the call
  1235.               is made, the default string displayed will the contents of
  1236.               the buffer at locations buffer[2] onwards. buffer[2] must be
  1237.               set to '\0' if this feature is not required.
  1238.  
  1239.               'prompt_colour' defined the colours to use for the prompt area.
  1240.  
  1241.               When a notice has been converted to a prompt, the call to
  1242.               'tcu_display_notice' will allow the user to enter the input
  1243.               string. The notice disappears when the input is complete,
  1244.               whereas a notice with no prompt area disappears when the user
  1245.               presses the RETURN key or the ESCAPE key.
  1246.  
  1247. Return Value  TCU_OK if the call was successful, TCU_ERROR if an error
  1248.               occurred.
  1249.  
  1250.  
  1251. tcu_restore_environment
  1252. -----------------------
  1253.  
  1254. Function      Restores the screen environment
  1255.  
  1256. Syntax        #include <usr\tcu.h>
  1257.               void tcu_restore_environment (void)
  1258.  
  1259. Remarks       This call should be made after the 'tcu_saqve_environment' call
  1260.               in an idle loop interrupt handler which changes the screen in
  1261.               some fashion. The calls which may alter the screen should be
  1262.               between 'tcu_save_environment' and 'tcu_restore_environment'.
  1263.  
  1264. Return Value  None.
  1265.  
  1266.  
  1267. tcu_put_field
  1268. -------------
  1269.  
  1270. Function      Loads a value into a field of a form.
  1271.  
  1272. Syntax        #include <usr\tcu.h>
  1273.               int tcu_put_field (TCU_FORM *form,
  1274.                                  int field,
  1275.                                  TCU_FIELD_VALUE *val)
  1276.  
  1277. Remarks       'form' identifies the form into which the value is to be
  1278.               loaded. 'field' is the field ID of the field, which may be
  1279.               obtained by 'tcu_get_field_id' if the field is named in the CUF
  1280.               file. 'val' is a pointer to a user declared TCU_FIELD_VALUE type
  1281.               which contains the value to be loaded.
  1282.  
  1283.               The value must comply with the type of the field and any
  1284.               range declaration which has been made in the CUF file. String
  1285.               lengths are checked, but compliance with string templates are
  1286.               not.
  1287.  
  1288.               See 'tcu_get_field' for details on how the field values in a
  1289.               form are addressed.
  1290.  
  1291.               If the form is currently displayed, the field is updated
  1292.               immediately.
  1293.  
  1294. Return Value  Returns TCU_OK if the call was successful, else TCU_ERROR.
  1295.  
  1296.  
  1297. tcu_read_formrec
  1298. ----------------
  1299.  
  1300. Function      Reads a complete form from a buffer.
  1301.  
  1302. Syntax        #include <usr\tcu.h>
  1303.               int tcu_read_formrec (TCU_FORM *form,
  1304.                                     char *buffer)
  1305.  
  1306. Remarks       'form' identifies the form into which the 'buffer' is to be
  1307.               read.  An implicit call to 'tcu_put_field' is made for each
  1308.               field to ensure integrity.
  1309.  
  1310. Return Value  Returns TCU_OK if the call was successful, else TCU_ERROR. An
  1311.               error condition is likely to indicate that one of the fields
  1312.               in the buffer is invalid for the form by being of an invalid
  1313.               type or out of the range specified in the form definition.
  1314.  
  1315.  
  1316. tcu_read_menu_selection
  1317. -----------------------
  1318.  
  1319. Function      Returns the user selection from a defined and displayed menu.
  1320.               If the user escapes from the menu with one of the permitted
  1321.               escape keys, the key code is returned, otherwise the selected
  1322.               menu option is returned.
  1323.  
  1324. Syntax        #include <usr\tcu.h>
  1325.               int tcu_read_menu_selection (TCU_MENU *menu)
  1326.  
  1327. Remarks       'tcu_read_menu_selection' is an interactive function to obtain a
  1328.               user selection from a displayed menu. Only valid escape keys
  1329.               may be used to leave the interactive selection procedure.
  1330.  
  1331. Return Value  If a valid menu option is selected, it is returned as a positive
  1332.               integer; 1 represents the first choice, 2 the second, etc.  If
  1333.               an option is unavailable for selection, it will simply not be
  1334.               returned under any circumstances. The numbering of the options
  1335.               is sequential, including unavailable options; i.e. If the menu
  1336.               has three possible options, the second of which is unavailable,
  1337.               the third has the logical sequence number '3' even though it is
  1338.               the second valid selection.
  1339.  
  1340.               If the return is 0, an error was encountered. This will most
  1341.               likely be due to either the menu not having been defined, or
  1342.               not yet displayed.
  1343.  
  1344.               If the return is negative, it represents the negative value of
  1345.               the escape key used to leave the selection. E.g. to determine
  1346.               if the ESC key was used to leave the menu, the following code
  1347.               extract could be used:
  1348.  
  1349.                     selection = tcu_read_menu_selection (&mymenu);
  1350.                     if (!selection)
  1351.                        ERROR_CONDITION;
  1352.                     else
  1353.                        if (selection > 0)
  1354.                           NORMAL_SELECTION_MADE;
  1355.                        else
  1356.                           if (selection == -TCU_ESC_ESC)
  1357.                              ESCAPE_KEY_USED;
  1358.                           else
  1359.                              ...SOME_OTHER_ESCAPE_KEY_USED;
  1360.  
  1361.               Note that for function keys and user defined escape keys the two
  1362.               services 'tcu_escape_fkey' and 'tcu_get_user_keypress' may be
  1363.               used to determine the exact keypress used.  In these cases, the
  1364.               return code from 'tcu_read_menu_selection' would be either
  1365.               -TCU_ESC_FUNC (for function keys) or -TCU_ESC_USERKEY (for user
  1366.               defined escape keys).
  1367.  
  1368.  
  1369. tcu_read_pulldown_selection
  1370. ---------------------------
  1371.  
  1372. Function      Returns a menu option selected under control of a pulldown menu.
  1373.  
  1374. Syntax        #include <usr\tcu.h>
  1375.               int tcu_read_pulldown_selection (TCU_PULLDOWN *pmenu,
  1376.                                                int *menu,
  1377.                                                int *option);
  1378.  
  1379. Remarks       'pmenu' specifies the pulldown menu which is to be activated
  1380.               and from which an option is to be read.  The menu must have been
  1381.               already defined with 'tcu_define_pulldown'.  'menu' returns the
  1382.               menu from the pulldown header from which the selection was made
  1383.               (in the range 1..No_of_menus) and 'option' returns the actual
  1384.               option within the menu (in the range 1..No_of_options_in_menu).
  1385.  
  1386.               If 'option' is zero and 'menu' is non-zero, the pulldown menu
  1387.               option selected did not have an associated menu.  If 'menu' is
  1388.               zero the pulldown menu selection was aborted with the ESC key
  1389.               and no selection was made.
  1390.  
  1391.               Note that 'tcu_read_pulldown_selection' does not clear the
  1392.               menu(s) from the screen on completion of the call (to allow a
  1393.               sequence of user defined events to take place on selection of
  1394.               an option), and may be called in sequence with intervening
  1395.               actions. Do NOT attempt to perform operations using menus
  1396.               within the pulldown system BETWEEN calls to the
  1397.               'tcu_read_pulldown_selection' other than the provided
  1398.               'tcu_clear_menu_in_pulldown' and 'tcu_new_pulldown_cover'
  1399.               services.  Use 'tcu_remove_pulldown' to clear the pulldown from
  1400.               the screen.
  1401.  
  1402. Return Value  Returns TCU_OK if the call was successful, else TCU_ERROR.
  1403.  
  1404.  
  1405. tcu_remove_form
  1406. ---------------
  1407.  
  1408. Function      Removes a form from the screen.
  1409.  
  1410. Syntax        #include <usr\tcu.h>
  1411.               int tcu_remove_form (TCU_FORM *form)
  1412.  
  1413. Remarks       'form' specifies the form which is to be removed. The
  1414.               definition is not removed; a 'tcu_display_form' is all that is
  1415.               required to redisplay the form.
  1416.  
  1417. Return Value  Returns TCU_OK if successful, TCU_ERROR if an error occurred.
  1418.  
  1419.  
  1420. tcu_remove_menu
  1421. ---------------
  1422.  
  1423. Function      Removes a displayed menu from the screen, restoring the original
  1424.               screen contents.
  1425.  
  1426. Syntax        #include <usr\tcu.h>
  1427.               int tcu_remove_menu (TCU_MENU *menu)
  1428.  
  1429. Remarks       If the menu to be removed is overlaid with another menu, the
  1430.               restoration of the screen will be incorrect. The user should
  1431.               ensure that selections from overlaid menus are satisfied by
  1432.               'tcu_read_menu_selection' and 'remove_menu' in the reverse order
  1433.               to that in which they were displayed with 'tcu_display_menu'.
  1434.  
  1435. Return Value  Returns TCU_OK if successful, or TCU_ERROR is unsuccessful.
  1436.               If unsuccessful the menu is logically flagged as removed, thus
  1437.               only leaving the screen incomplete.
  1438.  
  1439.  
  1440. tcu_remove_pulldown
  1441. -------------------
  1442.  
  1443. Function      Removes a pulldown menu from the screen, restoring the old
  1444.               screen contents.
  1445.  
  1446. Syntax        #include <usr\tcu.h>
  1447.               int tcu_remove_pulldown (TCU_PULLDOWN *pmenu);
  1448.  
  1449. Remarks       'pmenu' specifies the pulldown to be removed.  Note that the
  1450.               pulldown remains defined and may be activated again with the
  1451.               'tcu_read_pulldown_selection' service.
  1452.  
  1453. Return Value  TCU_OK if successful, or TCU_ERROR if an error occurred.
  1454.  
  1455.  
  1456. tcu_save_environment
  1457. --------------------
  1458.  
  1459. Function      Saves the screen environment.
  1460.  
  1461. Syntax        #include <usr\tcu.h>
  1462.               int tcu_push_environment (void)
  1463.  
  1464. Remarks       This service saves the screen environment for use inside
  1465.               idle loop handler functions which change the screen in
  1466.               some fashion. The calls which may alter the screen should be
  1467.               between 'tcu_save_environment' and 'tcu_restore_environment'.
  1468.  
  1469. Return Value  None.
  1470.  
  1471.  
  1472. tcu_select_field
  1473. ----------------
  1474.  
  1475. Function      Selects a single field from a form returning the field ID.
  1476.  
  1477. Syntax        #include <usr\tcu.h>
  1478.               int tcu_select_field (TCU_FORM *form,
  1479.                                     int start_field_id,
  1480.                                     int *exitkey);
  1481.  
  1482. Remarks       The service behaves exactly as 'tcu_edit_form', though
  1483.               disallowing any editing of fields and terminating at the first
  1484.               field select with the RETURN key. The form 'form' must be
  1485.               displayed. A start field 'start_field_id' determines which field
  1486.               will be the first one in which the cursor appears. If set to 1,
  1487.               the first valid field will be used. 'exitkey' will return with
  1488.               the field-ID of the field selected, or if negative will be one
  1489.               of the escape codes listed for 'tcu_edit_form'
  1490.  
  1491. Return Value  Returns with TCU_OK if no error, else TCU_ERROR.
  1492.  
  1493.  
  1494. tcu_set_button_fn
  1495. -----------------
  1496.  
  1497. Function      Establishes a button handler for a form.
  1498.  
  1499. Syntax        #include <usr\tcu.h>
  1500.               int tcu_set_button_fn (TCU_FORM *form,
  1501.                                      int far (*handler) (TCU_FORM *, int));
  1502.  
  1503. Remarks       'form' specifies the form for which the handler is to be
  1504.               activated. 'handler' is the handler to which control is passed
  1505.               when any button field on the form is selected. The two
  1506.               parameters passed by the system to the handler specify the
  1507.               form and the current button field ID.
  1508.  
  1509.               The handler must return one of three possible values according
  1510.               to the desired action:
  1511.  
  1512.                  0  =  Continue as if no key had been pressed, i.e. no
  1513.                        actions subsequent to the handler will be made as a
  1514.                        result of the selection.
  1515.  
  1516.                  1  =  Treat the keypress as a PgUp, i.e. save the results
  1517.                        of the form and exit. The exit code is
  1518.                        TCU_FLD_BUTTONSAVE.
  1519.  
  1520.                  2  =  Treat the keypress as an ESC, i.e. abort the form
  1521.                        entry and exit. The exit code is TCU_FLD_BUTTONESC.
  1522.  
  1523.               To remove an existing handler, set the function to NULL.
  1524.  
  1525.               If the handler code is to operate on objects outside the form in
  1526.               which the button exists (e.g. creates a new menu), the calls to
  1527.               services acting on the objects should be surrounded by calls to
  1528.               'tcu_save_environment' and 'tcu_restore_environment'.
  1529.  
  1530. Return Value  Returns TCU_OK if the handler was successfully installed, or
  1531.               TCU_ERROR if an error was encountered.
  1532.  
  1533.  
  1534. tcu_set_field_attrib
  1535. --------------------
  1536.  
  1537. Function      Sets the foreground and background colours of a field in a
  1538.               form.
  1539.  
  1540. Syntax        #include <usr\tcu.h>
  1541.               int tcu_set_field_attrib (TCU_FORM *form,
  1542.                                         int field,
  1543.                                         unsigned char new_colour)
  1544.  
  1545. Remarks       'form' identifies the form. 'field' is the field ID of the
  1546.               field to be changed. This may be returned by 'tcu_get_field_id'
  1547.               if the field is a named field. 'new_colour' specifies the new
  1548.               colours of the field, which may be obtained with the
  1549.               'tcu_colour_attrib' function.
  1550.  
  1551.               If the form is displayed, the colours are updated immediately.
  1552.  
  1553. Return Value  Returns TCU_OK if successful, TCU_ERROR if an error occurred.
  1554.  
  1555.  
  1556. tcu_set_field_mode
  1557. ------------------
  1558.  
  1559. Function      Sets a field attribute for a field in a form.
  1560.  
  1561. Syntax        #include <usr\tcu.h>
  1562.               int tcu_set_field_mode (TCU_FORM *form,
  1563.                                       int field,
  1564.                                       int mode)
  1565.  
  1566. Remarks       'form' specifies the form. 'field' is the field ID of the field.
  1567.               'mode' is one of the following:
  1568.  
  1569.                  TCU_FORM_EDIT   (def)  : Allow the field to be changed
  1570.                  TCU_FORM_NOEDIT        : Do not allow the field to be edited
  1571.                  TCU_FORM_ECHO   (def)  : Show field in form
  1572.                  TCU_FORM_NOECHO        : Do not display contents of field
  1573.                  TCU_FORM_ENTER  (def)  : Cursor may enter field during edit
  1574.                  TCU_FORM_NOENTER       : Cursor passes field by during edit
  1575.                  TCU_FORM_CONFIRM       : Needs ENTER to confirm field entry
  1576.                  TCU_FORM_NOCONFIFM (dflt)  : Prev. & next field confirm entry
  1577.  
  1578.               If the field is set NOEDIT, attempting to change the value of
  1579.               the field results in a tone.
  1580.  
  1581. Return Value  Returns TCU_OK if the mode was successfully set, else returns
  1582.               TCU_ERROR.
  1583.  
  1584.  
  1585. tcu_set_field_verify
  1586. --------------------
  1587.  
  1588. Function      Sets a verification function for a field.
  1589.  
  1590. Syntax        #include <usr\tcu.h>
  1591.               int tcu_set_field_verify (TCU_FORM *form,
  1592.                                         int far (*verify_fn)
  1593.                                                 (TCU_FORM *, int,
  1594.                                                  TCU_FIELD_VALUE *))
  1595.  
  1596.  
  1597. Remarks       'form' specifies the form. 'verify_fn' is the address of an
  1598.               integer function to perform the field verification. The function
  1599.               is passed the form address, an integer value which is the field
  1600.               ID and a pointer to the TCU_FIELD_VALUE structure of the field.
  1601.               The value must not be changed in the handler routine, other
  1602.               that by using 'tcu_put_field' with the passed 'form' parameter.
  1603.  
  1604.               The function should return 0 if the field failed verification
  1605.               and 1 if it verified successfully. If no field verification is
  1606.               specified, the range constraints on the field (if any) are the
  1607.               only checks made when the field is completed.
  1608.  
  1609.               Field verification is checked when an attempt to change the
  1610.               value of a field is made. This includes interactive form editing
  1611.               and changes with 'tcu_put_field'.
  1612.  
  1613. Return Value  Returns TCU_OK if verification was established successfully or
  1614.               TCU_ERROR if an error occurred.
  1615.  
  1616.  
  1617. tcu_set_form_fnkey_fn
  1618. ---------------------
  1619.  
  1620. Function      Establishes a function key handler function for form entry.
  1621.  
  1622. Syntax        #include <usr\tcu.h>
  1623.               int tcu_set_form_fnkey_fn (TCU_FORM *form,
  1624.                                          int far (*handler)
  1625.                                                  (TCU_FORM *, int, int));
  1626.  
  1627. Remarks       'form' specifies the form for which the handler is to be
  1628.               activated. 'handler' is the handler to which control is
  1629.               passed for all function keys. F1 is excluded as this is used
  1630.               exclusively for help invokation. The parameters passed by the
  1631.               system to the handler specify the form, the current field of the
  1632.               form and the actual function key (2-12) in that order.
  1633.  
  1634.               The handler must return one of three possible values according
  1635.               to the desired action:
  1636.  
  1637.                  0  =  Continue as if no key had been pressed, i.e. no
  1638.                        actions subsequent to the function key handler will
  1639.                        be made as a result of the keypress.
  1640.  
  1641.                  1  =  Treat the keypress as a PgUp, i.e. save the results
  1642.                        of the form and exit. The exit code is
  1643.                        TCU_FLD_FNKEYSAVE.
  1644.  
  1645.                  2  =  Treat the keypress as an ESC, i.e. abort the form
  1646.                        entry and exit. The exit code is TCU_FLD_ENKEYESC.
  1647.  
  1648.                  3  =  Same as 0, but update the field being edited with the
  1649.                        value set with a 'tcu_put_field'. This is used when a
  1650.                        'tcu_put_field' is called from within a function key
  1651.                        handler and the form is currently under edit.
  1652.  
  1653.               To remove an existing handler, set the function to NULL.
  1654.  
  1655. Return Value  Returns TCU_OK if the handler was successfully installed, or
  1656.               TCU_ERROR if an error was encountered.
  1657.  
  1658.  
  1659. tcu_set_form_help
  1660. -----------------
  1661.  
  1662. Function      Associates a help function with a form.
  1663.  
  1664. Syntax        #include <usr\tcu.h>
  1665.               int tcu_set_form_help (TCU_FORM *form,
  1666.                                      void far (*help_fn)(TCU_FORM *, int))
  1667.  
  1668. Remarks       'form' specifies the form, 'help_fn' is the address of a void
  1669.               function which will be called when the F1 key is pressed when
  1670.               the user is editing the form. The function is passed a single
  1671.               integer value which is the field ID. This allows the function
  1672.               to determine which field was selected when the help key was
  1673.               pressed.
  1674.  
  1675.               If no help function is defined for a field, the F1 key will
  1676.               generate a warning beep.
  1677.  
  1678. Return Value  Returns TCU_OK if the function was registered correctly, else
  1679.               TCU_ERROR.
  1680.  
  1681.  
  1682. tcu_set_form_mode
  1683. -----------------
  1684.  
  1685. Function      Sets the form edit mode for a complete form.
  1686.  
  1687. Syntax        #include <usr\tcu.h>
  1688.               int tcu_set_form_mode (TCU_FORM *form,
  1689.                                      int mode)
  1690.  
  1691. Remarks       'form' specifies the form. 'mode' is one of the following:
  1692.  
  1693.                  TCU_FORM_EDIT   (default)  : Form fields may be edited
  1694.                  TCU_FORM_NOEDIT            : Form fields may not be edited
  1695.                  TCU_FORM_ESCS   (default)  : Allow standard escape keys
  1696.                  TCU_FORM_NOESCS            : Disable all direct escape keys
  1697.  
  1698.               If the form mode is set to EDIT, the field modes may still
  1699.               prevent editing of individual fields.
  1700.  
  1701.               The escape keys include ESC, CNTL/C, PgUp and PgDn.  Disabling
  1702.               these keys allows the form to be controlled from handler
  1703.               functions returning appropriate continuation or escape codes.
  1704.  
  1705. Return Value  Returns TCU_OK if the mode was successfully set, else returns
  1706.               TCU_ERROR.
  1707.  
  1708.  
  1709. tcu_set_idle_loop
  1710. -----------------
  1711.  
  1712. Function      Establishes an idle processing handler
  1713.  
  1714. Syntax        #include <usr\tcu.h>
  1715.               int tcu_set_idle_loop (int far (*handler)(unsigned long))
  1716.  
  1717. Remarks       'handler' specifies the idle loop handler function to be
  1718.               installed. If a handler is present, it is called by TCU
  1719.               services every 10ms while waiting for a keypress or mouse
  1720.               click. It is passes a single unsigned long integer parameter
  1721.               which is the time in 10ms units that the system has been idle.
  1722.               If the handler wishes to emulate a keypress, it should return
  1723.               the scan-code of the key. If it returns zero, processing will
  1724.               continue.
  1725.  
  1726.               If the handler wishes to perform some activity which will
  1727.               change the contents of the screen, it should first save the
  1728.               screen environment with the 'tcu_save_environment' service. On
  1729.               completion of the screen updates, the 'tcu_restore_environment'
  1730.               call must be made. The idle processing function must be careful
  1731.               not to perform functions which alter parts of the screen
  1732.               being affected by currently executing foreground activities.
  1733.               Furthermore, should the idle handler need to operate on a
  1734.               form which is being edited when the handler is entered, it
  1735.               must use the special symbol '_TCU_UPDATE_form' as the FORM *
  1736.               type parameter to any form functions.
  1737.  
  1738. Return Value  Returns TCU_OK if the handler was successfully installed, else
  1739.               returns TCU_ERROR.
  1740.  
  1741.  
  1742. tcu_set_menu_help
  1743. -----------------
  1744.  
  1745. Function      Associates a help function with a menu.
  1746.  
  1747. Syntax        #include <usr\tcu.h>
  1748.               int tcu_set_menu_help (TCU_MENU *menu,
  1749.                                      void far (*handler)(int));
  1750.  
  1751. Remarks       'menu' specifies the menu to which the user defined help
  1752.               function, 'handler', is to refer.  Pressing the F1 function key
  1753.               while in the specified menu will activate this function, passing
  1754.               the currently selected menu option as a single integer parameter
  1755.               to the help function to allow an option specific action to be
  1756.               taken.
  1757.  
  1758.               Use NULL as a 'handler' value to remove the help function.  If
  1759.               F1 is pressed when no help function is available, a single tone
  1760.               will be sounded.
  1761.  
  1762. Return Value  TCU_OK if the help function was successfully installed, else
  1763.               TCU_ERROR.
  1764.  
  1765.  
  1766. tcu_set_menu_option
  1767. -------------------
  1768.  
  1769. Function      Enables or disables an option within a menu.
  1770.  
  1771. Syntax        #include <usr\tcu.h>
  1772.               int tcu_set_menu_option (TCU_MENU *menu,
  1773.                                        int choice,
  1774.                                        int mode)
  1775.  
  1776. Remarks       'choice' identifies the menu choice to be changed. 'mode' is
  1777.               0 to make a choice unavailable and 1 to enable a choice option.
  1778.  
  1779. Return Value  Returns TCU_OK if the call was successful, TCU_ERROR if an
  1780.               error was encountered.
  1781.  
  1782.  
  1783. tcu_set_mouse_mode
  1784. ------------------
  1785.  
  1786. Function      Enables or disables mouse support for menus and forms.
  1787.  
  1788. Syntax        #include <usr\tcu.h>
  1789.               int tcu_set_mouse_mode (unsigned char mode)
  1790.  
  1791. Remarks       The presence of a mouse is automatically detected and overrides
  1792.               any selection made with this service. By default mouse support
  1793.               if switched ON.  If mode is 0, mouse support will be disabled.
  1794.               If 1, it will be re-enabled. Note that the mouse mode may be
  1795.               toggled interactively by using the ALT-M key.
  1796.  
  1797. Return Value  TCU_OK if the service request was successful. TCU_ERROR means
  1798.               that no mouse was detected, though does not constitute a real
  1799.               error.
  1800.  
  1801.  
  1802. tcu_set_pulldown_help
  1803. ---------------------
  1804.  
  1805. Function      Associates a help function with a pulldown menu.
  1806.  
  1807. Syntax        #include <usr\tcu.h>
  1808.               int tcu_set_pulldown_help (TCU_PULLDOWN *pmenu,
  1809.                                          void far (*handler)(int));
  1810.  
  1811. Remarks       'menu' specifies the pulldown menu to which the user defined
  1812.               help function, 'handler', is to refer.  Pressing the F1 function
  1813.               key while on any pulldown title will activate this function,
  1814.               passing the currently selected menu option as a single integer
  1815.               parameter to the help function to allow an option specific
  1816.               action to be taken.
  1817.  
  1818.               Use NULL as a 'handler' value to remove the help function.  If
  1819.               F1 is pressed when no help function is available, a single tone
  1820.               will be sounded.
  1821.  
  1822. Return Value  TCU_OK if the help function was successfully installed, else
  1823.               TCU_ERROR.
  1824.  
  1825.  
  1826. tcu_set_user_key_handler
  1827. ------------------------
  1828.  
  1829. Function      Establishes a handler function to implement user defined keys
  1830.  
  1831. Syntax        #include <usr\tcu.h>
  1832.               int tcu_set_user_key_handler
  1833.                                       (int far (*handler)(unsigned short *));
  1834.  
  1835. Remarks       Establishes 'handler' as a function which will be invoked each
  1836.               time a key is pressed.  The function is passed a pointer to the
  1837.               key scancode, the dereferenced value of which may be altered if
  1838.               required, to allow it to decide how to process the keypress.
  1839.               The function will normally not alter the scancode.  The function
  1840.               should return 0 if no further action is required on behalf of
  1841.               the user defined keypress, 1 if the key is to be treated as an
  1842.               accept key (TCU_FLD_USERSAVE) and 2 if it is to be an escape key
  1843.               (TCU_FLD_USERESC).  The actual meaning of the returned value is
  1844.               dependent on the context.  E.g. TCU_FLD_USERSAVE during form
  1845.               entry will be treated exactly as TCU_FLD_ESCPGUP or
  1846.               TCU_FLD_ESCPGDN whilst TCU_FLD_USERESC is treated as
  1847.               TCU_FLD_ESCCNTLC.  This allows the user to implement individual
  1848.               key codes.  The actual key used by the user may be obtained with
  1849.               the 'tcu_get_user_keypress' service which returns the scancode.
  1850.  
  1851.               Note that the scancodes are standard, i.e. ALT-F1 is 104 (dec).
  1852.  
  1853.               Use NULL as the value of the function to be set to clear the
  1854.               present handler.
  1855.  
  1856. Return Value  TCU_OK if the help function was successfully installed, else
  1857.               TCU_ERROR.
  1858.  
  1859.  
  1860. _TCU_version
  1861. ------------
  1862.  
  1863. Function      Constant defining the version number of TCU
  1864.  
  1865. Syntax        #include <usr\tcu.h>
  1866.               extern unsigned char _TCU_version;
  1867.  
  1868. Remarks       The high-order nibble defines the major version number and the
  1869.               low-order nibble the minor version number.
  1870.  
  1871.                 printf ("This is TCU v%d.%d\n",
  1872.                         _TCU_version >> 4, _TCU_version & 0x0F);
  1873.  
  1874. Return Value  N/A
  1875.  
  1876.  
  1877. tcu_warnbeep
  1878. ------------
  1879.  
  1880. Function      Produce TCU standard warning beep sound
  1881.  
  1882. Syntax        #include <usr\tcu.h>
  1883.               void tcu_warnbeep (void)
  1884.  
  1885. Remarks       Sounds the warning beep used by TCU internals for such things
  1886.               as attempt to type into read-only form field, etc.
  1887.  
  1888. Return Value  None
  1889.  
  1890.  
  1891. tcu_wgets
  1892. ---------
  1893.  
  1894. Function      Receives user input from a window area.
  1895.  
  1896. Syntax        #include <usr\tcu.h>
  1897.               int tcu_wgets (TCU_WINDOW *window,
  1898.                              int maxlength,
  1899.                              char *buffer,
  1900.                              int *actuallength)
  1901.  
  1902. Remarks       Provides an editable input inside a window area. The input
  1903.               field must be on one line and may not extend beyond the
  1904.               window boundary. 'maxlength' specifies the maximum number of
  1905.               characters to input. 'buffer' is the address of a buffer to
  1906.               receive the input and should be at least maxlength+1 characters
  1907.               in length to include the null terminator. 'actuallength' is
  1908.               returned to indicate how many characters were present in the
  1909.               input field.
  1910.  
  1911.               The input buffer may be pre-loadad to give an inital input
  1912.               string. If the field should be empty, 'buffer' should be a
  1913.               zero length string.
  1914.  
  1915.               If the length is returned as -1, the user cancelled the input
  1916.               operation with ESC and the input string will be an empty
  1917.               string.
  1918.  
  1919. Return Value  TCU_OK on success, TCU_ERROR on error. Errors are likely to
  1920.               be the result of specifying an input area outside the boundary
  1921.               of the window.
  1922.  
  1923.  
  1924. tcu_write_formrec
  1925. -----------------
  1926.  
  1927. Function      Writes a complete form to a buffer.
  1928.  
  1929. Syntax        #include <usr\tcu.h>
  1930.               int tcu_write_formrec (TCU_FORM *form,
  1931.                                      char *buffer)
  1932.  
  1933. Remarks       'form' identifies the form which will be written to the
  1934.               'buffer'.  It is the caller's responsibility to ensure that
  1935.               the buffer points to sufficient free space to hold the form
  1936.               fields. The size may be obtained with the 'tcu_form_record_size'
  1937.               service.
  1938.  
  1939. Return Value  Returns TCU_OK if the call was successful, else TCU_ERROR.
  1940.  
  1941.  
  1942. tcu_wprintf
  1943. -----------
  1944.  
  1945. Function      Formatted output to a window.
  1946.  
  1947. Syntax        #include <usr\tcu.h>
  1948.               int tcu_wprintf (TCU_WINDOW *window,
  1949.                                char *format,
  1950.                                arg1, arg2, arg3, ...)
  1951.  
  1952. Remarks       As the C run-time library 'printf' function but to a window.
  1953.               Long lines will wrap around.
  1954.  
  1955. Return Value  TCU_OK on success, TCU_ERROR on error.
  1956.