home *** CD-ROM | disk | FTP | other *** search
-
- INPUT subroutines replace BASIC's INKEY$ or INPUT commands, and add
- functions not available with BASIC alone.
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: ClearKey
- object file: clearkey.obj (getkey.obj)
-
- Removes all keypresses from the keyboard's "type ahead" buffer.
- Works with standard and enhanced keyboards.
-
- Example:
- CALL ClearKey
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Function: keycode% = DGetKey
- object file: dgetkey.obj
-
- Using DOS functions, DGetKey returns the ASCII character code of
- the first keypress waiting in the keyboard buffer. If the key code
- returned > 255, then the key pressed is an extended keycode (such as
- the function keys F1 - F10) and the ASCII code of the key is (code%
- AND 255). If no keypresses are waiting in the keyboard buffer,
- DGetKey waits until a key is pressed before it returns to BASIC.
- Unlike GetKey, below, input to DGeyKey may be redirected from the
- command line. DGeyKey does not support F11 or F12 function keys.
- DGetKey allows ^C to pass through as keycode% = 3 without causing your
- program to stop. ^<Break> works the same as ^C in compiled programs;
- in the QuickBASIC or QBX development enviornment, ^<break> causes
- suspension of program operation (as it normally does). See your BASIC
- manual for ASCII character codes.
-
- Example:
- REM $INCLUDE: 'qlib.bi'
- keycode% = DGetKey
- IF keycode% < 255 THEN PRINT CHR$(keycode%) ' prints key pressed
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Function: GPullDown(VARPTR(menu$(0)), choice0%, choice1%)
- object files: gpulldn.obj (q$menu.obj and several others)
- (for graphics modes; requires QuickBASIC or BC7
- without /fs switch - NOT for QBX development
- enviornment or VBDOS)
-
- Function: PullDown(VARPTR(menu$(0)), choice0%, choice1%)
- object files: pulldown.obj (q$menu.obj and several others)
- (for text modes)
-
- Subroutine: MenuOption(optionnumber%, option% [option$ for option 6])
- object file: q$menu.obj
-
- Pull-down menu system similar to the menus in the QuickBASIC
- development environment. You may specify initial main choice and
- initial submenu choice (choice0% and choice1%). PullDown returns to
- BASIC when either ESC or RETURN is pressed, and returns the menu choice
- in choice0% and choice1%. Use cursor keys, home/end, pgup/pgdown or
- mouse to move cursor. PullDown will also jump to a menu choice when an
- alphabetic key is pressed if that menu choice includes a capitalized
- letter, and the key pressed matches the capital letter ("Hotkey"
- feature). Menu choices are disabled if all lower case.
-
- PullDown (and GPullDown) saves the screen under the menu, and restores
- the screen when it exits.
-
- If choice1% (initial submenu choice) < 0, the main selections
- will be printed without submenus. You may move among the main
- headings with left & right arrow keys or with the mouse. Submenus
- are displayed when Enter or any mouse buttons are pressed, or when
- up or down arrows are pressed, or when the mouse pointer is moved up
- or down. Esc will erase the main headings and return to BASIC.
-
- MenuOption is used to specify colors. Options supported are:
-
- option 0 = normal text color
- option 1 = highlight color (menu choice)
- option 2 = menu box color
- option 3 = hotkey color
-
- If you do not specify colors, PullDown uses bright white text and
- menu box, reverse video menu choice and hotkey color.
-
- Other options are:
-
- option 4 = user-specified exit key code (see GetKey for keycodes)
- option 5 = exit when hotkey is pressed
- option 6 = user-specified string printed at right edge of screen
- (PullDown only - NOT for VBDOS, QBX or PDS /FS option)
- option 7 = allow selection of string without capital letter
- (VertList only)
- option 8 = allow numeric (0 - 9) hotkey (set option <> 0)
-
- Any menu option may be canceled by setting the option = 0.
-
- Example:
- see MENU.BAS example program
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Function: keycode% = GetKey
- object file: getkey.obj (asmflags.obj)
-
- Returns the ASCII character code of the first keypress waiting in
- the keyboard buffer. If the key code returned > 255, then the key
- pressed is an extended keycode (such as the function keys F1 - F10)
- and the ASCII code of the key is (code% AND 255). If no keypresses are
- waiting in the keyboard buffer, GetKey waits until a key is pressed
- before it returns to BASIC. GetKey supports F11 and F12 on 101-key
- keyboards if the PC's BIOS also supports 101-key keyboards (See GetKBD).
- See your BASIC manual for most ASCII character codes.
-
- ASCII character codes for F11 and F12 are not listed in some BASIC
- manuals:
- with SHIFT with CTRL with ALT
- F11 133 135 137 139
- F12 134 136 138 140
-
- Example:
- REM $INCLUDE: 'qlib.bi'
- keycode% = GetKey
- IF keycode% AND 256 THEN
- keycode% = keycode% AND 255
- IF keycode% = 138 THEN PRINT "CTRL+F12 was pressed"
- ELSE
- .
- .
- .
- END IF
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: GetMouseSpeed(horiz%, vert%, threshold%)
- object file: mouspeed.obj
-
- GetMouseSpeed determines the current horizontal and vertical
- mickeys per pixel speed and the threshold speed at which the mouse
- cursor's motion doubles. For the horizontal and vertical speed,
- a higher number means a faster mouse. Conversely, a higher
- double-speed threshold suggests slower mouse motion. Your program
- should use IsMouse sometime before calling GetMouseSpeed. See also
- SetMouseSpeed.
-
- Example:
- DEFINT A-Z
- CALL GetMouseSpeed(horiz, vert, threshold)
-
- REM I want to reduce the double-speed threshold
- REM without changing the base horizontal and vertical mickeys
- REM per pixel ratio.
-
- CALL ShiftINT(threshold, -1) ' shift right 1 = divide by two
-
- CALL SetMouseSpeed(horiz, vert, threshold)
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Function: keycode% = GVertList(VARPTR(a$(0)), x0%, y0%, choice%)
- object files: gvlist.obj (q$menu.obj, m$input.obj, gprint.obj, others)
-
- Vertical List menu subroutine for all QLIB graphics modes; prints
- a list of menu choices on the screen at (x, y), user selects one menu
- choice with cursor keys or with a "hot key". Use of the "hot key"
- requires at least one capital letter (A-Z) in the menu choice; the
- "hot key" is that letter. If IsMouse was called earlier in the
- program, the mouse may also be used to select a menu choice. GVertList
- returns to the calling program when Enter, ESC, or (optionally) a
- user-defined exit key or hotkey or mouse button is pressed. If a mouse
- button was pressed, keycode% = 768 OR [button code].
-
- Button codes are:
- 1 = left button
- 2 = right button
- 4 = center button
-
- GVertList restores the previous screen contents on exit.
-
- GVertList shares the MenuOption subroutines with other QLIB menu
- subroutines. GVertList recognizes options 0 - 5. See MenuOption.
-
- Example:
- REM $INCLUDE: 'qlib.bi'
-
- ' set up list of menu choices, using programmer's string data
- ' in DATA statement
- DIM a$(10)
- FOR i = 0 to 9: READ a$(i): NEXT i
- a$(10) = "" ' make sure NUL string is at end of string array
-
- SCREEN 12
- ' specify bright red color for menu choice and "hot key"
- ' and specify F10 as additional exit key
- CALL MenuOption(1, 12): CALL MenuOption(3, 12)
- CALL MenuOption(4, (256 OR 68))
-
- ' start with cursor at top of list
- choice = 0
- p = VARPTR(a$(0)): x0 = 100: y0 = 100
- keycode = GVertList(p, x, y, choice)
- SELECT CASE keycode
- CASE 13 ' ENTER was pressed
- SELECT CASE choice
- .
- .
- END SELECT
- CASE 27 ' ESC was pressed
- .
- .
- CASE (256 OR 68) ' F10 was pressed
- .
- .
- CASE 769 to 772 ' mouse button pressed
- .
- END SELECT
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: HideMouse
- object file: mouse.obj (mousedat.obj)
-
- Makes the mouse cursor disappear. The mouse driver continues to
- track the mouse's motion and button status.
-
- Example:
- HideMouse
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: HideGMouse
- object file: gmouse.obj (mousedat.obj, $graph.obj)
-
- Makes the alternate graphics mouse cursor disappear. QLIB's
- alternate mouse driver continues to track the mouse's motion.
- See GMouse in GRAPHICS.DOC.
-
- Example:
- HideGMouse
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Function: k% = IsAlpha(keycode%)
- object file: isalpha.obj
-
- Function: k% = IsDigit(keycode%)
- Function: k% = IsLower(keycode%)
- Function: k% = IsUpper(keycode%)
-
- These function quickly determine if keycode% is an alphabetic
- character (A-Z, a-z: IsAlpha), a numeric digit (0-9: IsDigit), a
- lower-case alphabetic character (a-z: IsLower) or an upper-case
- alphabetic character (A-Z: IsUpper). k% = keycode% if keycode%
- meets the function's search criteria, or k% = 0 if keycode is not
- 0-9, A-Z, or a-z (depending on the function). Keycode% may be the
- output of LineEdit, GLineEdit or the GetKey or DGetKey functions.
-
- Example:
- REM $INCLUDE: 'qlib.bi'
- REM I want to input only lowercase a-z
-
- 10: k% = IsLower(GetKey)
- IF k% = 0 GOTO 10
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Function: JaNein
- object file: janein.obj
-
- German language version of YesNo. Waits for either "J" or "N" to be
- pressed, then returns the ASCII character code of the key pressed.
- The character code returned will be the code for UPPER case "J" or "N",
- regardless of whether the key pressed was upper or lower case.
-
- Example:
- REM $INCLUDE: 'QLIB.BI'
- PRINT "Are you sure? (J/N)"
- REM ASC("J") = 74, ASC("N") = 78
- IF JaNein = 78 THEN
- . ' instructions for N response
- .
- .
- ELSE
- . ' instructions for J response
- .
- .
- END IF
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Function: k% = KeyFilter(s1$, s2$, keycode%)
- object file: keyfilt.obj
-
- KeyFilter compares keycode% to each character in the strings
- s1$ and s2$, and returns k% = 0 unless keycode% matches a character
- in the search strings. If keycode% is a normal character (i.e., not
- a function key), then s1$ is used. If keycode% is an extended keycode,
- (keycode% > 255) then s2$ is used. See example.
-
- Example:
- REM $INCLUDE: 'qlib.bi'
- REM I want to input only the letters a, c and g (upper or lower case)
- REM and I also want to watch for F10 (keycode% = 256 OR 68)
- s1$ = "aAcCgG"
- s2$ = CHR$(68)
- 10: k% = KeyFilter(s1$, s2$, keycode%)
- IF k% = 0 GOTO 10
-
- REM Note that KeyFilter may also be called using one of QLIB's input
- REM functions such as GetKey, DGetKey or KeyIfWaiting like this:
- REM 10: k% = KeyFilter(s1$, s2$, KeyIfWaiting)
- REM IF k% = 0 GOTO ...
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Function: keycode% = KeyIfWaiting
- object files: kifwait.obj (getkey.obj, asmflags.obj)
-
- Uses BIOS calls to determine whether a key is waiting in the keyboard
- buffer, returning the key to BASIC. If no key is waiting, KeyIfWaiting
- returns keycode% = 0. KeyIfWaiting supports F11 and F12 keys on 101-key
- keyboards if the PC's BIOS also supports these keyboards.
-
- Example:
- keycode% = KeyIfWaiting
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: KeyOrButton(buttons%, keycode%)
- object files: mouse.obj (getkey.obj)
-
- Returns first key pressed or mouse button pressed. If no key is waiting
- in the keyboard buffer and no mouse button is pressed, KeyOrButton waits
- until one of these events happens. If a key is waiting in the keyboard
- buffer before KeyOrButton is called, the key is returned to QB without
- checking mouse buttons. Buttons% = 0 if a key has been read, otherwise
- buttons% indicates which buttons are pressed. See GetKey for key codes,
- and see the example below for buttons% codes. More than one button may
- be pressed.
-
- Example:
- CALL KeyOrButton(buttons%, keycode%)
- msg$ = ""
- IF buttons% THEN
- IF buttons% AND 1 THEN msg$ = "left button pressed "
- IF buttons% AND 2 THEN msg$ = msg$ + "right button pressed "
- IF buttons% AND 4 THEN msg$ = msg$ + "center button pressed"
- PRINT msg$
- ELSE
- ' action for key pressed
- END IF
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Function: a% = KeyWaiting
- object file: getkey.obj (asmflags.obj)
-
- Uses BIOS calls to determine whether a key is waiting in the keyboard
- buffer, without reading the key. KeyWaiting supports F11 and F12 keys on
- 101-key keyboards if the PC's BIOS also supports these keyboards.
-
- Example:
- REM $INCLUDE: 'qlib.bi'
- IF KeyWaiting% THEN PRINT "A key has been pressed"
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: LineEdit(st$, row%, col%, attr%, options%, keycode%)
- Subroutine: StartEdit(startcol%)
- Function: LastEdit
- object files: lineedit.obj (q$edit.obj, crt.obj, q$qprn.obj, cursor.obj,
- getkey.obj)
-
- LineEdit displays st$ at (row%, col%) and provides many editing
- functions, returning the edited string to BASIC. The length of st$
- will not change during the editing process. Options are provided to
- restrict legal input or to provide additional information, depending on
- the bits set in options%. See LineEdit's Summary of Commands, below.
- See GetKey to interpret the keycode% returned by LineEdit.
- StartEdit may be used before calling LineEdit in order to begin or
- resume editing at a specified position in st$ (default position is
- 1, the left end of the string). LastEdit is used after LineEdit returns
- to BASIC, to determine the cursor position in st$ when control was
- returned to BASIC.
- LineEdit turns the cursor off when returning to BASIC. You may
- use BASIC's LOCATE command or QLIB's CursorON subroutine to restore
- the cursor. LineEdit works only in text mode. Use GLineEdit in graphics
- modes (See GLineEdit in GRAPHICS.DOC.). LineEdit will edit any string up
- to 32,767 bytes long. See also WindowEdit.
-
- Thanks to Thomas Cullins for his bug report on the BC7/QBX version of
- LineEdit.
-
- Summary of LineEdit commands:
-
- Enter, Esc = return string to BASIC
- Left arrow, Right arrow = move cursor
- Insert = toggle insert/overstrike modes
- Home = move cursor to start of line
- End = move cursor to end of text
- Delete = delete character at cursor and close up space
- Backspace = move cursor back one space, delete character, and close space
- Ctrl+End = clear from cursor to end of line
- Ctrl+Left, Ctrl+Right = move cursor one word
-
- LineEdit options and examples are on the next page.
-
-
- LineEdit options:
-
- 1 = Lower Case
- 2 = Upper Case
- 1 + 2 = Numerals only
- 1 + 2 + 4 = Numerals and numeric punctuation ($,.%-+*/)
- 8 = use BIOS to display string (default is DVM)
- 32 = Return to BASIC if cursor is past end of string
- 64 = Return to BASIC if normal key pressed
- 128 = Return to BASIC if extended key (F1 - F10, etc.) is pressed.
- NOTE: if this option is used and an extended key is pressed,
- keycode% returned as 256 + the ASCII code of the extended
- key. This may be used along with StartEdit and LastEdit
- to trap specified extended key presses. See examples.
- 256 = Return to calling program if ALT key is pressed. keycode%
- is returned = 256.
- &H4000 = Return to calling program if TAB key is pressed
- &H8000 = Use alternate reverse video cursor instead of the blinking
- hardware cursor. This option may cause "snow" on CGA monitors.
- The cursor position is indicated by a black character on a
- white background; in insert mode, either the character blinks
- or the background is high intensity, depending on the last call
- to SetBLINK (see VIDEO.DOC). To preserve compatability with
- future versions of LineEdit, do not use this option with
- option 8. This version of LineEdit ignores option -32768 if
- option 8 is used.
-
- Use BASIC's OR operator to combine options.
-
- Example 1:
- st$ = "This is the string to be edited "
- ' extra spaces allow for inserted characters
- row% = 5: col% = 10
- options% = 0 ' allow all characters, no fancy stuff
- CALL LineEdit(st$, row%, col%, attr%, options%, keycode%)
-
- Example 2:
- REM $INCLUDE: 'qlib.bi'
- st$ = "This is the string to be edited": row% = 5: col% = 10
- options% = 2 OR 128 ' All text input converted to upper case and
- ' return to calling program if extended key
- ' pressed.
- ' I want to trap F1, which returns the ASCII
- ' code a% = 59 (see your BASIC manual for
- ' extended key codes)
- 10 CALL LineEdit(st$, row%, col%, attr%, options%, keycode%)
- IF keycode% AND 256 THEN
- a% = keycode% AND 255
- IF a% = 59 THEN ... ' do F1 stuff
- ' else go back to LineEdit:
- CALL StartEdit(LastEdit) ' re-set cursor location
- GOTO 10 ' and go back to LineEdit
- END IF
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Function: keycode% = MaskEdit(mask$, row%, column%, attr%, options%)
- object file: maskedit.obj (getkey.obj, qprint.obj, cursor.obj)
-
- Permits a string with fixed fields and fixed delimiters to be
- edited. This can be used, for example, to input telephone numbers
- or ZIP codes, or other fixed-field data. MaskEdit will permit only
- the characters in the input string which are numbers, letters or
- space characters to be edited, skipping over field delimiters.
- MaskEdit will optionally limit input to numerals, or will force
- lower-case input, or upper-case input. MaskEdit returns to your
- BASIC program when either ESC or ENTER is pressed. MaskEdit options
- are:
-
- 1 = a-z forced to upper case
- 2 = A-Z forced to lower case
- 3 = numerals only allowed
- &H400 = exit if TAB pressed while cursor is in last field of mask$
-
- row% and column% are the location on the screen where you want
- the string to be printed, and attr% is the color attribute to be used.
- You may use the TAB key to jump from one field to the next, and
- shift+TAB jumps the cursor back to the previous field. You may also
- use the left, right, home and end keys to move the cursor.
-
- Example:
- REM $INCLUDE: 'qlib.bi'
- REM define the mask for entering telephone numbers
- REM I'm using CHR$(255) as a non-editable space character
-
- mask$ = "( )"+CHR$(255)+" - "
-
- REM Note that the mask may contain a default response
- REM such as mask$ = "(916)" + CHR$(255) + "721-8762"
-
- phone$ = mask$ ' don't disturb mask$
- options% = 3
- keycode% = MaskEdit(phone$, row%, column%, attr%, options%)
- IF keycode% = 27 THEN ' ESC was pressed
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: MouseStatus(x%, y%, buttons%)
- object file: mstatus.obj (mousedat.obj)
-
- Returns the mouse button status and mouse position. Buttons% is
- a code which indicates which mouse buttons, if any, are pressed, and
- the PIXEL coordinates of the mouse cursor, even in text modes.
- Pixel coordinates start with (0,0) in the upper left corner.
- X-coordinates are horizontal and Y-coordinates are vertical (increasing
- from top of screen to bottom). See KeyOrButton to decode buttons%.
- To determine mouse cursor position in terms of text locations, see
- TMouseStatus.
-
- Example:
- CALL MouseStatus(x%, y%, buttons%)
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Function: OuiNon
- object file: ouinon.obj
-
- French language version of YesNo. Waits for either "O" or "N" to be
- pressed, then returns the ASCII character code of the key pressed.
- The character code returned will be the code for UPPER case "O" or "N",
- regardless of whether the key pressed was upper or lower case.
-
- Example:
- REM $INCLUDE: 'QLIB.BI'
- PRINT "Are you sure? (O/N)"
- REM ASC("O") = 79, ASC("N") = 78
- IF OuiNon = 78 THEN
- . ' instructions for N response
- .
- .
- ELSE
- . ' instructions for O response
- .
- .
- END IF
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: PutKey(asciicode%, scancode%)
- object file: putkey.obj
-
- requires AT (286 or better) BIOS
-
- PutKey puts a keycode in the keyboard buffer. ASCIIcode% is the
- key returned by GetKey; Scancode% is used by other keypress detecting
- functions.
-
- Example:
- REM I want to put a TAB keycode in the keyboard buffer
- REM the ASCII code is 9 and the scan code is 15
-
- CALL PutKey(9, 15)
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: SetMouseSpeed(horiz%, vert%, threshold%)
-
- Sets mouse driver's sensetivity to mouse motion. Horiz and Vert are
- mickeys per pixel (1 - 32767, higher number is faster) and threshold
- is the speed at which the mouse cursor doubles its speed.
- For the horizontal and vertical speed, a higher number means a
- faster mouse. Conversely, a higher double-speed threshold suggests
- slower mouse motion. Your program should use IsMouse sometime before
- calling SetMouseSpeed. See also GetMouseSpeed.
-
- Example:
- DEFINT A-Z
- CALL GetMouseSpeed(horiz, vert, threshold)
-
- REM I want to reduce the double-speed threshold
- REM without changing the bas horizontal and vertical mickeys
- REM per pixel ratio.
-
- CALL ShiftINT(threshold, -1) ' shift right 1 = divide by two
-
- CALL SetMouseSpeed(horiz, vert, threshold)
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: ShowMouse
- object file: mouse.obj (mousedat.obj)
-
- ShowMouse makes the mouse cursor visible.
-
- Example:
- CALL ShowMouse
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: ShowGMouse
- object file: gmouse.obj (mousedat.obj, $graph.obj)
-
- ShowGMouse makes the alternate graphics mouse cursor visible.
- See GMouse in GRAPHICS.DOC.
-
- Example:
- CALL ShowGMouse
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Function: SiNo
- object file: sino.obj
-
- Spanish language version of YesNo. Waits for either "S" or "N" to be
- pressed, then returns the ASCII character code of the key pressed.
- The character code returned will be the code for UPPER case "S" or "N",
- regardless of whether the key pressed was upper or lower case.
-
- Example:
- REM $INCLUDE: 'QLIB.BI'
- PRINT "Are you sure? (S/N)"
- REM ASC("S") = 83, ASC("N") = 78
- IF SiNo = 78 THEN
- . ' instructions for N response
- .
- .
- ELSE
- . ' instructions for S response
- .
- .
- END IF
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: TMouseStatus(col%, row%, buttons%)
- object file: tmstatus.obj
-
- TMouseStatus is similar to MouseStatus, but returns the mouse cursor's
- position as (col%, row%) character coordinates instead of pixel
- coordinates. Note that most QLIB subroutines use column and row
- coordinates in reverse order (row%, col%) instead of TMouseStatus'
- (col%, row%). Buttons% is the mouse's button status. See KeyOrButton
- to decode button status.
-
- Example:
- CALL TMouseStatus(col%, row%, buttons%)
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Function: keycode% = VertList(VARPTR(a$(0)), row%, col%, choice%)
- object files: vlist.obj (q$menu.obj, m$input.obj, crt.obj, q$qprn.obj,
- several others)
-
- Vertical list menu system; requires an array of varable-length strings,
- upper left corner coordinates (row%, col%) and starting position
- (choice%). VertList returns to BASIC when Esc, Enter or an
- optional user-defined exit key is pressed, or when a mouse button is
- pressed. The keycode of the key pressed is returned as keycode% and
- the menu selection is returned as choice%. If a mouse button was
- pressed, keycode% = 768 OR [button code]. Button codes are:
-
- 1 = left button
- 2 = right button
- 4 = center button
-
- VertList uses all menu options except option 6 (user-specified
- prompt string). See MenuOption. Option 7 enables the selection of
- strings without capital letters. If the option value is -1, any string
- may be selected. A character other than a capital letter may be used
- if the option value = ASC(character).
-
- Example 1:
- REM $INCLUDE: 'qlib.bi'
-
- DIM mainmenu$(9) ' 10 menu strings, 0-9; last string is NUL
- FOR I= 0 TO 9
- READ mainmenu$(I) ' strings are in a DATA statement
- ' end of menu string data marked with a NUL string
- NEXT I
- row% = 5: col% = 10: choice% = 0
- ' "light bar" positioned at mainmenu$(0)
- mm% = VARPTR(mainmenu$(0))
- keycode% = VertList(mm%, row%, col%, choice%)
-
-
- Example 2:
- REM my list of strings is a list of filenames including the
- REM "\" and "..\"
- REM I want to enable the selection of the "..\" and "\" choices.
- CALL MenuOption(7, ASC("\")) ' enable selection of "\" character
- mm% = VARPTR(filelist$(0))
- keycode% = VertList(mm%, row%. col%, choice%)
-
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Subroutine: WindowEdit(st$, r0%, c0%, r1%, c1%, attr%, keycode%)
- object files: wedit.obj (q$qprn.obj, q$crt.obj, q$clrw.obj, cursor.obj,
- getkey.obj, trimr.obj)
-
- requires: QuickBASIC or BASIC 7.x with near strings;
- far strings and QBX not supported.
-
- Similar to LineEdit, WindowEdit edits the string st$ in a window on
- a text-mode screen and returns the result to BASIC. WindowEdit is still
- in the early stages of development; your comments and suggestions will
- influence my development of this subroutine.
-
- WindowEdit differs from LineEdit in that it includes word wrap and
- up/down cursor movement, and the string scrolls in the window. Before
- calling WindowEdit, st$ should be as long as you wish to allow. Call
- WindowEdit with (r0%, c0%) the upper left corner of the space you
- want the string to occupy, and (r1%, c1%) the lower right corner of
- the window. attr% is the color attribute used by WindowEdit and
- keycode% is the key pressed that made WindowEdit return to BASIC.
-
- Summary of WindowEdit commands:
-
- Enter, Esc = return string to BASIC
- Left, Right, Up, Down arrows = move cursor
- Insert = toggle insert/overstrike modes
- Home = move cursor to start of line
- End = move cursor to end of line
- Delete = delete character at cursor and close up space
- Backspace = move cursor back one space, delete character, and close space
-
- Example:
-
- REM I have an existing string that I want to edit, and the program
- REM should allow the string to be as long as 1024 bytes.
-
- DEFINT A-Z
- existing$ = "There are no bananas in the house"
- e$ = existing$ + SPACE$(1024 - LEN(existing$))
- r0 = 5: c0 = 5: r1 = 15: c1 = 20
- attr = 23
- CALL WindowEdit(e$, r0, c0, r1, c1, attr, keycode)
-
- REM replace previous string with new string
- REM after removing the unused spaces at the end
- REM then free some string space by reducing e$ to nothing
-
- existing$ = RTRIM$(e$): e$ = ""
-
-
- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- Function: YesNo
- object file: yesno.obj
-
- Waits for either "Y" or "N" to be pressed, then returns the ASCII
- character code of the key pressed. The character code returned will be
- the code for UPPER case "Y" or "N", regardless of whether the key pressed
- was upper or lower case.
-
- Example:
- REM $INCLUDE: 'QLIB.BI'
- PRINT "Are you sure? (Y/N)"
- REM ASC("Y") = 89, ASC("N") = 78
- IF YesNo = 78 THEN
- . ' instructions for N response
- .
- .
- ELSE
- . ' instructions for Y response
- .
- .
- END IF
-