home *** CD-ROM | disk | FTP | other *** search
/ Point Programming 1 / PPROG1.ISO / basic / qlib / input.doc < prev    next >
Encoding:
Text File  |  1994-01-01  |  31.0 KB  |  797 lines

  1.  
  2.   INPUT subroutines replace BASIC's INKEY$ or INPUT commands, and add
  3.   functions not available with BASIC alone.
  4.  
  5.  
  6.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  7.  
  8.     Subroutine: ClearKey
  9.     object file: clearkey.obj (getkey.obj)
  10.  
  11.         Removes all keypresses from the keyboard's "type ahead" buffer.
  12.     Works with standard and enhanced keyboards.
  13.  
  14.     Example:
  15.         CALL ClearKey
  16.  
  17.  
  18.  
  19.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  20.  
  21.     Function: keycode% = DGetKey
  22.     object file: dgetkey.obj
  23.  
  24.          Using DOS functions, DGetKey returns the ASCII character code of
  25.     the first keypress waiting in the keyboard buffer.  If the key code
  26.     returned > 255, then the key pressed is an extended keycode (such as
  27.     the function keys F1 - F10) and the ASCII code of the key is (code%
  28.     AND 255).  If no keypresses are waiting in the keyboard buffer,
  29.     DGetKey waits until a key is pressed before it returns to BASIC.
  30.     Unlike GetKey, below, input to DGeyKey may be redirected from the
  31.     command line.  DGeyKey does not support F11 or F12 function keys.
  32.     DGetKey allows ^C to pass through as keycode% = 3 without causing your
  33.     program to stop.  ^<Break> works the same as ^C in compiled programs;
  34.     in the QuickBASIC or QBX development enviornment, ^<break> causes
  35.     suspension of program operation (as it normally does).  See your BASIC
  36.     manual for ASCII character codes.
  37.  
  38.     Example:
  39.         REM $INCLUDE: 'qlib.bi'
  40.         keycode% = DGetKey
  41.         IF keycode% < 255 THEN PRINT CHR$(keycode%)   ' prints key pressed
  42.  
  43.  
  44.  
  45.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  46.  
  47.     Function: GPullDown(VARPTR(menu$(0)), choice0%, choice1%)
  48.     object files: gpulldn.obj (q$menu.obj and several others)
  49.               (for graphics modes; requires QuickBASIC or BC7
  50.                without /fs switch -  NOT for QBX development
  51.                enviornment or VBDOS)
  52.  
  53.     Function: PullDown(VARPTR(menu$(0)), choice0%, choice1%)
  54.     object files: pulldown.obj (q$menu.obj and several others)
  55.               (for text modes)
  56.  
  57.     Subroutine: MenuOption(optionnumber%, option% [option$ for option 6])
  58.     object file: q$menu.obj
  59.  
  60.     Pull-down menu system similar to the menus in the QuickBASIC
  61.     development environment.  You may specify initial main choice and
  62.     initial submenu choice (choice0% and choice1%).  PullDown returns to
  63.     BASIC when either ESC or RETURN is pressed, and returns the menu choice
  64.     in choice0% and choice1%.  Use cursor keys, home/end, pgup/pgdown or
  65.     mouse to move cursor.  PullDown will also jump to a menu choice when an
  66.     alphabetic key is pressed if that menu choice includes a capitalized
  67.     letter, and the key pressed matches the capital letter ("Hotkey"
  68.     feature).  Menu choices are disabled if all lower case.
  69.  
  70.     PullDown (and GPullDown) saves the screen under the menu, and restores
  71.     the screen when it exits.
  72.  
  73.     If choice1% (initial submenu choice) < 0, the main selections
  74.     will be printed without submenus.  You may move among the main
  75.     headings with left & right arrow keys or with the mouse.  Submenus
  76.     are displayed when Enter or any mouse buttons are pressed, or when
  77.     up or down arrows are pressed, or when the mouse pointer is moved up
  78.     or down.  Esc will erase the main headings and return to BASIC.
  79.  
  80.     MenuOption is used to specify colors.  Options supported are:
  81.  
  82.     option 0 = normal text color
  83.     option 1 = highlight color (menu choice)
  84.     option 2 = menu box color
  85.     option 3 = hotkey color
  86.  
  87.     If you do not specify colors, PullDown uses bright white text and
  88.     menu box, reverse video menu choice and hotkey color.
  89.  
  90.     Other options are:
  91.  
  92.     option 4 = user-specified exit key code (see GetKey for keycodes)
  93.     option 5 = exit when hotkey is pressed
  94.     option 6 = user-specified string printed at right edge of screen
  95.                (PullDown only - NOT for VBDOS, QBX or PDS /FS option)
  96.     option 7 = allow selection of string without capital letter
  97.                (VertList only)
  98.     option 8 = allow numeric (0 - 9) hotkey (set option <> 0)
  99.  
  100.     Any menu option may be canceled by setting the option = 0.
  101.  
  102.     Example:
  103.        see MENU.BAS example program
  104.  
  105.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  106.  
  107.     Function: keycode% = GetKey
  108.     object file: getkey.obj (asmflags.obj)
  109.  
  110.         Returns the ASCII character code of the first keypress waiting in
  111.     the keyboard buffer.  If the key code returned > 255, then the key
  112.     pressed is an extended keycode (such as the function keys F1 - F10)
  113.     and the ASCII code of the key is (code% AND 255).  If no keypresses are
  114.     waiting in the keyboard buffer, GetKey waits until a key is pressed
  115.     before it returns to BASIC.  GetKey supports F11 and F12 on 101-key
  116.     keyboards if the PC's BIOS also supports 101-key keyboards (See GetKBD).
  117.     See your BASIC manual for most ASCII character codes.
  118.  
  119.     ASCII character codes for F11 and F12 are not listed in some BASIC
  120.     manuals:
  121.                    with SHIFT     with CTRL      with ALT
  122.     F11       133       135            137            139
  123.     F12       134       136            138            140
  124.  
  125.     Example:
  126.          REM $INCLUDE: 'qlib.bi'
  127.          keycode% = GetKey
  128.          IF keycode% AND 256 THEN
  129.               keycode% = keycode% AND 255
  130.               IF keycode% = 138 THEN PRINT "CTRL+F12 was pressed"
  131.               ELSE
  132.            .
  133.            .
  134.            .
  135.          END IF
  136.  
  137.  
  138.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  139.  
  140.     Subroutine: GetMouseSpeed(horiz%, vert%, threshold%)
  141.     object file: mouspeed.obj
  142.  
  143.     GetMouseSpeed determines the current horizontal and vertical
  144.     mickeys per pixel speed and the threshold speed at which the mouse
  145.     cursor's motion doubles.  For the horizontal and vertical speed,
  146.     a higher number means a faster mouse.  Conversely, a higher
  147.     double-speed threshold suggests slower mouse motion.  Your program
  148.     should use IsMouse sometime before calling GetMouseSpeed.  See also
  149.     SetMouseSpeed.
  150.  
  151.     Example:
  152.          DEFINT A-Z
  153.          CALL GetMouseSpeed(horiz, vert, threshold)
  154.  
  155.          REM  I want to reduce the double-speed threshold
  156.          REM  without changing the base horizontal and vertical mickeys
  157.          REM  per pixel ratio.
  158.  
  159.          CALL ShiftINT(threshold, -1)  ' shift right 1 = divide by two
  160.  
  161.          CALL SetMouseSpeed(horiz, vert, threshold)
  162.  
  163.  
  164.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  165.  
  166.     Function: keycode% = GVertList(VARPTR(a$(0)), x0%, y0%, choice%)
  167.     object files: gvlist.obj (q$menu.obj, m$input.obj, gprint.obj, others)
  168.  
  169.          Vertical List menu subroutine for all QLIB graphics modes; prints
  170.     a list of menu choices on the screen at (x, y), user selects one menu
  171.     choice with cursor keys or with a "hot key".  Use of the "hot key"
  172.     requires at least one capital letter (A-Z) in the menu choice; the
  173.     "hot key" is that letter.  If IsMouse was called earlier in the
  174.     program, the mouse may also be used to select a menu choice. GVertList
  175.     returns to the calling program when Enter, ESC, or (optionally) a
  176.     user-defined exit key or hotkey or mouse button is pressed.  If a mouse
  177.     button was pressed, keycode% = 768 OR [button code].
  178.  
  179.     Button codes are:
  180.       1 = left button
  181.       2 = right button
  182.       4 = center button
  183.  
  184.     GVertList restores the previous screen contents on exit.
  185.  
  186.     GVertList shares the MenuOption subroutines with other QLIB menu
  187.     subroutines.  GVertList recognizes options 0 - 5.  See MenuOption.
  188.  
  189.     Example:
  190.          REM $INCLUDE: 'qlib.bi'
  191.  
  192.          ' set up list of menu choices, using programmer's string data
  193.          ' in DATA statement
  194.          DIM a$(10)
  195.          FOR i = 0 to 9: READ a$(i): NEXT i
  196.          a$(10) = ""         ' make sure NUL string is at end of string array
  197.  
  198.          SCREEN 12
  199.          ' specify bright red color for menu choice and "hot key"
  200.          ' and specify F10 as additional exit key
  201.          CALL MenuOption(1, 12): CALL MenuOption(3, 12)
  202.          CALL MenuOption(4, (256 OR 68))
  203.  
  204.          ' start with cursor at top of list
  205.          choice = 0
  206.          p = VARPTR(a$(0)): x0 = 100: y0 = 100
  207.          keycode = GVertList(p, x, y, choice)
  208.          SELECT CASE keycode
  209.              CASE 13               ' ENTER was pressed
  210.                  SELECT CASE choice
  211.                        .
  212.                        .
  213.                  END SELECT
  214.              CASE 27               ' ESC was pressed
  215.                  .
  216.                  .
  217.              CASE (256 OR 68)      ' F10 was pressed
  218.                  .
  219.                  .
  220.              CASE 769 to 772       ' mouse button pressed
  221.                  .
  222.          END SELECT
  223.  
  224.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  225.  
  226.     Subroutine: HideMouse
  227.     object file: mouse.obj (mousedat.obj)
  228.  
  229.          Makes the mouse cursor disappear.  The mouse driver continues to
  230.     track the mouse's motion and button status.
  231.  
  232.     Example:
  233.          HideMouse
  234.  
  235.  
  236.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  237.  
  238.     Subroutine: HideGMouse
  239.     object file: gmouse.obj (mousedat.obj, $graph.obj)
  240.  
  241.          Makes the alternate graphics mouse cursor disappear.  QLIB's
  242.     alternate mouse driver continues to track the mouse's motion.
  243.     See GMouse in GRAPHICS.DOC.
  244.  
  245.     Example:
  246.          HideGMouse
  247.  
  248.  
  249.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  250.  
  251.     Function: k% = IsAlpha(keycode%)
  252.     object file: isalpha.obj
  253.  
  254.     Function: k% = IsDigit(keycode%)
  255.     Function: k% = IsLower(keycode%)
  256.     Function: k% = IsUpper(keycode%)
  257.  
  258.          These function quickly determine if keycode% is an alphabetic
  259.     character (A-Z, a-z: IsAlpha), a numeric digit (0-9: IsDigit), a
  260.     lower-case alphabetic character (a-z: IsLower) or an upper-case
  261.     alphabetic character (A-Z: IsUpper).  k% = keycode% if keycode%
  262.     meets the function's search criteria, or k% = 0 if keycode is not
  263.     0-9, A-Z, or a-z (depending on the function).  Keycode% may be the
  264.     output of LineEdit, GLineEdit or the GetKey or DGetKey functions.
  265.  
  266.     Example:
  267.       REM $INCLUDE: 'qlib.bi'
  268.       REM I want to input only lowercase a-z
  269.  
  270. 10:   k% = IsLower(GetKey)
  271.       IF k% = 0 GOTO 10
  272.  
  273.  
  274.  
  275.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  276.  
  277.     Function: JaNein
  278.     object file: janein.obj
  279.  
  280.     German language version of YesNo.  Waits for either "J" or "N" to be
  281.     pressed, then returns the ASCII character code of the key pressed.
  282.     The character code returned will be the code for UPPER case "J" or "N",
  283.     regardless of whether the key pressed was upper or lower case.
  284.  
  285.     Example:
  286.          REM $INCLUDE: 'QLIB.BI'
  287.          PRINT "Are you sure? (J/N)"
  288.          REM  ASC("J") = 74, ASC("N") = 78
  289.          IF JaNein = 78 THEN
  290.                    .         ' instructions for N response
  291.                    .
  292.                    .
  293.               ELSE
  294.                    .         ' instructions for J response
  295.                    .
  296.                    .
  297.          END IF
  298.  
  299.  
  300.  
  301.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  302.  
  303.     Function: k% = KeyFilter(s1$, s2$, keycode%)
  304.     object file: keyfilt.obj
  305.  
  306.         KeyFilter compares keycode% to each character in the strings
  307.     s1$ and s2$, and returns k% = 0 unless keycode% matches a character
  308.     in the search strings.  If keycode% is a normal character (i.e., not
  309.     a function key), then s1$ is used.  If keycode% is an extended keycode,
  310.     (keycode% > 255) then s2$ is used.  See example.
  311.  
  312.     Example:
  313.     REM $INCLUDE: 'qlib.bi'
  314.     REM  I want to input only the letters a, c and g (upper or lower case)
  315.     REM  and I also want to watch for F10 (keycode% = 256 OR 68)
  316.     s1$ = "aAcCgG"
  317.     s2$ = CHR$(68)
  318. 10: k% = KeyFilter(s1$, s2$, keycode%)
  319.     IF k% = 0 GOTO 10
  320.  
  321.     REM  Note that KeyFilter may also be called using one of QLIB's input
  322.     REM  functions such as GetKey, DGetKey or KeyIfWaiting like this:
  323.     REM  10: k% = KeyFilter(s1$, s2$, KeyIfWaiting)
  324.     REM      IF k% = 0 GOTO ...
  325.  
  326.  
  327.  
  328.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  329.  
  330.     Function: keycode% = KeyIfWaiting
  331.     object files: kifwait.obj (getkey.obj, asmflags.obj)
  332.  
  333.     Uses BIOS calls to determine whether a key is waiting in the keyboard
  334.     buffer, returning the key to BASIC.  If no key is waiting, KeyIfWaiting
  335.     returns keycode% = 0.  KeyIfWaiting supports F11 and F12 keys on 101-key
  336.     keyboards if the PC's BIOS also supports these keyboards.
  337.  
  338.     Example:
  339.          keycode% = KeyIfWaiting
  340.  
  341.  
  342.  
  343.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  344.  
  345.     Subroutine: KeyOrButton(buttons%, keycode%)
  346.     object files: mouse.obj (getkey.obj)
  347.  
  348.     Returns first key pressed or mouse button pressed.  If no key is waiting
  349.     in the keyboard buffer and no mouse button is pressed, KeyOrButton waits
  350.     until one of these events happens.  If a key is waiting in the keyboard
  351.     buffer before KeyOrButton is called, the key is returned to QB without
  352.     checking mouse buttons.  Buttons% = 0 if a key has been read, otherwise
  353.     buttons% indicates which buttons are pressed.  See GetKey for key codes,
  354.     and see the example below for buttons% codes.  More than one button may
  355.     be pressed.
  356.  
  357.     Example:
  358.         CALL KeyOrButton(buttons%, keycode%)
  359.         msg$ = ""
  360.         IF buttons% THEN
  361.                IF buttons% AND 1 THEN msg$ = "left button pressed "
  362.                IF buttons% AND 2 THEN msg$ = msg$ + "right button pressed "
  363.                IF buttons% AND 4 THEN msg$ = msg$ + "center button pressed"
  364.                PRINT msg$
  365.                ELSE
  366.                            ' action for key pressed
  367.         END IF
  368.  
  369.  
  370.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  371.  
  372.     Function: a% = KeyWaiting
  373.     object file: getkey.obj (asmflags.obj)
  374.  
  375.     Uses BIOS calls to determine whether a key is waiting in the keyboard
  376.     buffer, without reading the key.  KeyWaiting supports F11 and F12 keys on
  377.     101-key keyboards if the PC's BIOS also supports these keyboards.
  378.  
  379.     Example:
  380.          REM $INCLUDE: 'qlib.bi'
  381.          IF KeyWaiting% THEN PRINT "A key has been pressed"
  382.  
  383.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  384.  
  385.     Subroutine: LineEdit(st$, row%, col%, attr%, options%, keycode%)
  386.     Subroutine: StartEdit(startcol%)
  387.     Function: LastEdit
  388.     object files: lineedit.obj (q$edit.obj, crt.obj, q$qprn.obj, cursor.obj,
  389.                                 getkey.obj)
  390.  
  391.          LineEdit displays st$ at (row%, col%) and provides many editing
  392.     functions, returning the edited string to BASIC.  The length of st$
  393.     will not change during the editing process.  Options are provided to
  394.     restrict legal input or to provide additional information, depending on
  395.     the bits set in options%.  See LineEdit's Summary of Commands, below.
  396.     See GetKey to interpret the keycode% returned by LineEdit.
  397.          StartEdit may be used before calling LineEdit in order to begin or
  398.     resume editing at a specified position in st$ (default position is
  399.     1, the left end of the string).  LastEdit is used after LineEdit returns
  400.     to BASIC, to determine the cursor position in st$ when control was
  401.     returned to BASIC.
  402.          LineEdit turns the cursor off when returning to BASIC.  You may
  403.     use BASIC's LOCATE command or QLIB's CursorON subroutine to restore
  404.     the cursor.  LineEdit works only in text mode.  Use GLineEdit in graphics
  405.     modes (See GLineEdit in GRAPHICS.DOC.).  LineEdit will edit any string up
  406.     to 32,767 bytes long.  See also WindowEdit.
  407.  
  408.     Thanks to Thomas Cullins for his bug report on the BC7/QBX version of
  409.     LineEdit.
  410.  
  411.      Summary of LineEdit commands:
  412.  
  413.      Enter, Esc = return string to BASIC
  414.      Left arrow, Right arrow = move cursor
  415.      Insert = toggle insert/overstrike modes
  416.      Home = move cursor to start of line
  417.      End = move cursor to end of text
  418.      Delete = delete character at cursor and close up space
  419.      Backspace = move cursor back one space, delete character, and close space
  420.      Ctrl+End = clear from cursor to end of line
  421.      Ctrl+Left, Ctrl+Right = move cursor one word
  422.  
  423.      LineEdit options and examples are on the next page.
  424.  
  425.  
  426.      LineEdit options:
  427.  
  428.      1 = Lower Case
  429.      2 = Upper Case
  430.      1 + 2 = Numerals only
  431.      1 + 2 + 4 = Numerals and numeric punctuation ($,.%-+*/)
  432.      8 = use BIOS to display string (default is DVM)
  433.      32 = Return to BASIC if cursor is past end of string
  434.      64 = Return to BASIC if normal key pressed
  435.      128 = Return to BASIC if extended key (F1 - F10, etc.) is pressed.
  436.               NOTE: if this option is used and an extended key is pressed,
  437.               keycode% returned as 256 + the ASCII code of the extended
  438.               key.  This may be used along with StartEdit and LastEdit
  439.               to trap specified extended key presses.  See examples.
  440.      256 = Return to calling program if ALT key is pressed.  keycode%
  441.               is returned = 256.
  442.      &H4000 = Return to calling program if TAB key is pressed
  443.      &H8000 = Use alternate reverse video cursor instead of the blinking
  444.               hardware cursor.  This option may cause "snow" on CGA monitors.
  445.               The cursor position is indicated by a black character on a
  446.               white background; in insert mode, either the character blinks
  447.               or the background is high intensity, depending on the last call
  448.               to SetBLINK (see VIDEO.DOC).  To preserve compatability with
  449.               future versions of LineEdit, do not use this option with
  450.               option 8.  This version of LineEdit ignores option -32768 if
  451.               option 8 is used.
  452.  
  453.     Use BASIC's OR operator to combine options.
  454.  
  455.     Example 1:
  456.          st$ = "This is the string to be edited              "
  457.                                   ' extra spaces allow for inserted characters
  458.          row% = 5: col% = 10
  459.          options% = 0             ' allow all characters, no fancy stuff
  460.          CALL LineEdit(st$, row%, col%, attr%, options%, keycode%)
  461.  
  462.     Example 2:
  463.          REM $INCLUDE: 'qlib.bi'
  464.          st$ = "This is the string to be edited": row% = 5: col% = 10
  465.          options% = 2 OR 128 ' All text input converted to upper case and
  466.                              ' return to calling program if extended key
  467.                              ' pressed.
  468.                              ' I want to trap F1, which returns the ASCII
  469.                              ' code a% = 59 (see your BASIC manual for
  470.                              ' extended key codes)
  471. 10       CALL LineEdit(st$, row%, col%, attr%, options%, keycode%)
  472.          IF keycode% AND 256 THEN
  473.               a% = keycode% AND 255
  474.               IF a% = 59 THEN ...      ' do F1 stuff
  475.                                        '    else go back to LineEdit:
  476.               CALL StartEdit(LastEdit) ' re-set cursor location
  477.               GOTO 10                  ' and go back to LineEdit
  478.          END IF
  479.  
  480.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  481.  
  482.     Function: keycode% = MaskEdit(mask$, row%, column%, attr%, options%)
  483.     object file: maskedit.obj (getkey.obj, qprint.obj, cursor.obj)
  484.  
  485.          Permits a string with fixed fields and fixed delimiters to be
  486.     edited.  This can be used, for example, to input telephone numbers
  487.     or ZIP codes, or other fixed-field data.  MaskEdit will permit only
  488.     the characters in the input string which are numbers, letters or
  489.     space characters to be edited, skipping over field delimiters.
  490.     MaskEdit will optionally limit input to numerals, or will force
  491.     lower-case input, or upper-case input.  MaskEdit returns to your
  492.     BASIC program when either ESC or ENTER is pressed.  MaskEdit options
  493.     are:
  494.  
  495.         1 = a-z forced to upper case 
  496.         2 = A-Z forced to lower case 
  497.         3 = numerals only allowed
  498.     &H400 = exit if TAB pressed while cursor is in last field of mask$
  499.  
  500.     row% and column% are the location on the screen where you want
  501.     the string to be printed, and attr% is the color attribute to be used.
  502.     You may use the TAB key to jump from one field to the next, and
  503.     shift+TAB jumps the cursor back to the previous field.  You may also
  504.     use the left, right, home and end keys to move the cursor.
  505.  
  506.     Example:
  507.        REM $INCLUDE: 'qlib.bi'
  508.        REM  define the mask for entering telephone numbers
  509.        REM  I'm using CHR$(255) as a non-editable space character
  510.  
  511.        mask$ = "(   )"+CHR$(255)+"   -    "
  512.  
  513.        REM  Note that the mask may contain a default response
  514.        REM  such as mask$ = "(916)" + CHR$(255) + "721-8762"
  515.  
  516.        phone$ = mask$                 ' don't disturb mask$
  517.        options% = 3
  518.        keycode% = MaskEdit(phone$, row%, column%, attr%, options%)
  519.        IF keycode% = 27 THEN          ' ESC was pressed
  520.  
  521.  
  522.  
  523.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  524.  
  525.     Subroutine: MouseStatus(x%, y%, buttons%)
  526.     object file: mstatus.obj (mousedat.obj)
  527.  
  528.          Returns the mouse button status and mouse position.  Buttons% is
  529.     a code which indicates which mouse buttons, if any, are pressed, and
  530.     the PIXEL coordinates of the mouse cursor, even in text modes.
  531.     Pixel coordinates start with (0,0) in the upper left corner.
  532.     X-coordinates are horizontal and Y-coordinates are vertical (increasing
  533.     from top of screen to bottom).  See KeyOrButton to decode buttons%.
  534.     To determine mouse cursor position in terms of text locations, see
  535.     TMouseStatus.
  536.  
  537.     Example:
  538.          CALL MouseStatus(x%, y%, buttons%)
  539.  
  540.  
  541.  
  542.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  543.  
  544.     Function: OuiNon
  545.     object file: ouinon.obj
  546.  
  547.     French language version of YesNo.  Waits for either "O" or "N" to be
  548.     pressed, then returns the ASCII character code of the key pressed.
  549.     The character code returned will be the code for UPPER case "O" or "N",
  550.     regardless of whether the key pressed was upper or lower case.
  551.  
  552.     Example:
  553.          REM $INCLUDE: 'QLIB.BI'
  554.          PRINT "Are you sure? (O/N)"
  555.          REM  ASC("O") = 79, ASC("N") = 78
  556.          IF OuiNon = 78 THEN
  557.                    .         ' instructions for N response
  558.                    .
  559.                    .
  560.               ELSE
  561.                    .         ' instructions for O response
  562.                    .
  563.                    .
  564.          END IF
  565.  
  566.  
  567.  
  568.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  569.  
  570.     Subroutine: PutKey(asciicode%, scancode%)
  571.     object file: putkey.obj
  572.  
  573.     requires AT (286 or better) BIOS
  574.  
  575.         PutKey puts a keycode in the keyboard buffer.  ASCIIcode% is the
  576.     key returned by GetKey; Scancode% is used by other keypress detecting
  577.     functions.
  578.  
  579.     Example:
  580.         REM I want to put a TAB keycode in the keyboard buffer
  581.         REM the ASCII code is 9 and the scan code is 15
  582.  
  583.         CALL PutKey(9, 15)
  584.  
  585.  
  586.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  587.  
  588.     Subroutine: SetMouseSpeed(horiz%, vert%, threshold%)
  589.  
  590.     Sets mouse driver's sensetivity to mouse motion.  Horiz and Vert are
  591.     mickeys per pixel (1 - 32767, higher number is faster) and threshold
  592.     is the speed at which the mouse cursor doubles its speed.
  593.     For the horizontal and vertical speed, a higher number means a
  594.     faster mouse.  Conversely, a higher double-speed threshold suggests
  595.     slower mouse motion.  Your program should use IsMouse sometime before
  596.     calling SetMouseSpeed.  See also GetMouseSpeed.
  597.  
  598.     Example:
  599.          DEFINT A-Z
  600.          CALL GetMouseSpeed(horiz, vert, threshold)
  601.  
  602.          REM  I want to reduce the double-speed threshold
  603.          REM  without changing the bas horizontal and vertical mickeys
  604.          REM  per pixel ratio.
  605.  
  606.          CALL ShiftINT(threshold, -1)  ' shift right 1 = divide by two
  607.  
  608.          CALL SetMouseSpeed(horiz, vert, threshold)
  609.  
  610.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  611.  
  612.     Subroutine: ShowMouse
  613.     object file: mouse.obj (mousedat.obj)
  614.  
  615.          ShowMouse makes the mouse cursor visible.
  616.  
  617.     Example:
  618.          CALL ShowMouse
  619.  
  620.  
  621.  
  622.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  623.  
  624.     Subroutine: ShowGMouse
  625.     object file: gmouse.obj (mousedat.obj, $graph.obj)
  626.  
  627.          ShowGMouse makes the alternate graphics mouse cursor visible.
  628.     See GMouse in GRAPHICS.DOC.
  629.  
  630.     Example:
  631.          CALL ShowGMouse
  632.  
  633.  
  634.  
  635.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  636.  
  637.     Function: SiNo
  638.     object file: sino.obj
  639.  
  640.     Spanish language version of YesNo.  Waits for either "S" or "N" to be
  641.     pressed, then returns the ASCII character code of the key pressed.
  642.     The character code returned will be the code for UPPER case "S" or "N",
  643.     regardless of whether the key pressed was upper or lower case.
  644.  
  645.     Example:
  646.          REM $INCLUDE: 'QLIB.BI'
  647.          PRINT "Are you sure? (S/N)"
  648.          REM  ASC("S") = 83, ASC("N") = 78
  649.          IF SiNo = 78 THEN
  650.                    .         ' instructions for N response
  651.                    .
  652.                    .
  653.               ELSE
  654.                    .         ' instructions for S response
  655.                    .
  656.                    .
  657.          END IF
  658.  
  659.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  660.  
  661.     Subroutine: TMouseStatus(col%, row%, buttons%)
  662.     object file: tmstatus.obj
  663.  
  664.     TMouseStatus is similar to MouseStatus, but returns the mouse cursor's
  665.     position as (col%, row%) character coordinates instead of pixel
  666.     coordinates.  Note that most QLIB subroutines use column and row
  667.     coordinates in reverse order (row%, col%) instead of TMouseStatus'
  668.     (col%, row%).  Buttons% is the mouse's button status.  See KeyOrButton
  669.     to decode button status.
  670.  
  671.     Example:
  672.          CALL TMouseStatus(col%, row%, buttons%)
  673.  
  674.  
  675.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  676.  
  677.     Function: keycode% = VertList(VARPTR(a$(0)), row%, col%, choice%)
  678.     object files: vlist.obj (q$menu.obj, m$input.obj, crt.obj, q$qprn.obj,
  679.                              several others)
  680.  
  681.     Vertical list menu system; requires an array of varable-length strings,
  682.     upper left corner coordinates (row%, col%) and starting position
  683.     (choice%).  VertList returns to BASIC when Esc, Enter or an
  684.     optional user-defined exit key is pressed, or when a mouse button is
  685.     pressed.  The keycode of the key pressed is returned as keycode% and
  686.     the menu selection is returned as choice%.  If a mouse button was
  687.     pressed, keycode% = 768 OR [button code].  Button codes are:
  688.  
  689.      1 = left button
  690.      2 = right button
  691.      4 = center button
  692.  
  693.     VertList uses all menu options except option 6 (user-specified
  694.     prompt string).  See MenuOption.  Option 7 enables the selection of
  695.     strings without capital letters.  If the option value is -1, any string
  696.     may be selected.  A character other than a capital letter may be used
  697.     if the option value = ASC(character).
  698.  
  699.     Example 1:
  700.     REM $INCLUDE: 'qlib.bi'
  701.  
  702.     DIM mainmenu$(9)      ' 10 menu strings, 0-9; last string is NUL
  703.     FOR I= 0 TO 9
  704.       READ mainmenu$(I)   ' strings are in a DATA statement
  705.                           ' end of menu string data marked with a NUL string
  706.     NEXT I
  707.     row% = 5: col% = 10: choice% = 0
  708.                           ' "light bar" positioned at mainmenu$(0)
  709.     mm% = VARPTR(mainmenu$(0))
  710.     keycode% = VertList(mm%, row%, col%, choice%)
  711.  
  712.  
  713.     Example 2:
  714.     REM  my list of strings is a list of filenames including the
  715.     REM  "\" and "..\"
  716.     REM  I want to enable the selection of the "..\" and "\" choices.
  717.     CALL MenuOption(7, ASC("\"))   ' enable selection of "\" character
  718.     mm% = VARPTR(filelist$(0))
  719.     keycode% = VertList(mm%, row%. col%, choice%)
  720.     
  721.  
  722.  
  723.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  724.  
  725.     Subroutine: WindowEdit(st$, r0%, c0%, r1%, c1%, attr%, keycode%)
  726.     object files: wedit.obj (q$qprn.obj, q$crt.obj, q$clrw.obj, cursor.obj,
  727.                              getkey.obj, trimr.obj)
  728.  
  729.     requires: QuickBASIC or BASIC 7.x with near strings;
  730.               far strings and QBX not supported.
  731.  
  732.          Similar to LineEdit, WindowEdit edits the string st$ in a window on
  733.     a text-mode screen and returns the result to BASIC.  WindowEdit is still
  734.     in the early stages of development; your comments and suggestions will
  735.     influence my development of this subroutine.
  736.  
  737.     WindowEdit differs from LineEdit in that it includes word wrap and
  738.     up/down cursor movement, and the string scrolls in the window.  Before
  739.     calling WindowEdit, st$ should be as long as you wish to allow.  Call
  740.     WindowEdit with (r0%, c0%) the upper left corner of the space you
  741.     want the string to occupy, and (r1%, c1%) the lower right corner of
  742.     the window.  attr% is the color attribute used by WindowEdit and
  743.     keycode% is the key pressed that made WindowEdit return to BASIC.
  744.  
  745.     Summary of WindowEdit commands:
  746.  
  747.      Enter, Esc = return string to BASIC
  748.      Left, Right, Up, Down arrows = move cursor
  749.      Insert = toggle insert/overstrike modes
  750.      Home = move cursor to start of line
  751.      End = move cursor to end of line
  752.      Delete = delete character at cursor and close up space
  753.      Backspace = move cursor back one space, delete character, and close space
  754.  
  755.     Example:
  756.  
  757.      REM  I have an existing string that I want to edit, and the program
  758.      REM  should allow the string to be as long as 1024 bytes.
  759.  
  760.     DEFINT A-Z
  761.     existing$ = "There are no bananas in the house"
  762.     e$ = existing$ + SPACE$(1024 - LEN(existing$))
  763.     r0 = 5: c0 = 5: r1 = 15: c1 = 20
  764.     attr = 23
  765.     CALL WindowEdit(e$, r0, c0, r1, c1, attr, keycode)
  766.  
  767.     REM  replace previous string with new string
  768.     REM  after removing the unused spaces at the end
  769.     REM  then free some string space by reducing e$ to nothing
  770.  
  771.     existing$ = RTRIM$(e$): e$ = ""
  772.  
  773.  
  774.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  775.  
  776.     Function: YesNo
  777.     object file: yesno.obj
  778.  
  779.          Waits for either "Y" or "N" to be pressed, then returns the ASCII
  780.     character code of the key pressed.  The character code returned will be
  781.     the code for UPPER case "Y" or "N", regardless of whether the key pressed
  782.     was upper or lower case.
  783.  
  784.     Example:
  785.          REM $INCLUDE: 'QLIB.BI'
  786.          PRINT "Are you sure? (Y/N)"
  787.          REM  ASC("Y") = 89, ASC("N") = 78
  788.          IF YesNo = 78 THEN
  789.                    .         ' instructions for N response
  790.                    .
  791.                    .
  792.               ELSE
  793.                    .         ' instructions for Y response
  794.                    .
  795.                    .
  796.          END IF
  797.