(1/4) Input routine

 BBS: Inland Empire Archive
Date: 06-14-93 (01:23)             Number: 327
From: JIM LITTLE                   Refer#: NONE
  To: ERIC LOW                      Recvd: NO  
Subj: (1/4) Input routine            Conf: (2) Quik_Bas
 > *** As Jim Little blabbed to Bob Oehrle...

(blabbed?)   :)

 > JL> inputting too many characters.  Unnumerable super-fancy input programs
 > JL> have been posted here in the past -- if you want, I'll give you mine..
 > JL> just ask.

 > I'd like a copy of that, Jim.  Thanx.

Ok, here ya go:

'______O_/__________________| SNIP |__________________\_O______
'      O \                  | HERE |                  / O
'This file created by PostIt! v6.1.
'>>> Start of page 1.

'These routines will input a line of text of up 32K, within the bounds
' of the window specified.  If more text is inputted than there is room,
' the text scrolls.  Insert, delete, home and end all perform expected
' functions.  Color is not supported, but could be added without difficulty.
'A quirk: Although the text scrolls at 'right', an additional space is
' required for the cursor, and this space -will- overwrite anything at
' that location.  So count on allowing at least one blank space beyond
' 'right'.
'This routine works without speed problems on my 386DX/40.. but I have
' not tested on anything slower.  If anybody sees a problem, please let
' me know!

'Jim Little

'This code is not copyrighted.  It may be used by anyone for any purpose.
' Merry Christmas.  <grin>

DECLARE SUB Printline (topletter AS INTEGER, text AS STRING,_
 left AS INTEGER, right AS INTEGER)
DECLARE SUB cInput (text AS STRING, left AS INTEGER, right AS_
 INTEGER, length AS INTEGER, flag AS INTEGER)
DECLARE SUB GetStroke (keystroke AS INTEGER)

CONST kBackspace = 8                   'ASCII values for some
' keys, as returned by GetStroke
CONST kTab = 9
CONST kReturn = 13
CONST kEscape = 27
CONST kSpace = 32
CONST kInsert = -82
CONST kDelete = -83
CONST kHome = -71
CONST kEnd = -79
CONST kPageUp = -73
CONST kPageDown = -81
CONST kUpArrow = -72
CONST kDownArrow = -80
CONST kLeftArrow = -75
CONST kRightArrow = -77

CONST cOk = 0                          'constants used by 'flag'
' in cInput
CONST cUpArrow = 1
CONST cDownArrow = 2
CONST cPageUp = 3
CONST cPageDown = 4
CONST cEscape = 5
CONST cNull = 6   'Note: not returned by cInput

CONST False = 0
CONST True = NOT False

'sample.. delete this and import remainder into your programs.

CLS
LOCATE , 32
PRINT "<-- Input scrolls at this point.";

text$ = "This is a test"
cInput text$, 1, 30, 80, flag%

PRINT : PRINT
PRINT "Text recieved: "; text$
PRINT
PRINT "Input terminated with ";
SELECT CASE flag%
   CASE cOk
      PRINT "a return."
   CASE cUpArrow
      PRINT "the up arrow."
   CASE cDownArrow
      PRINT "the down arrow."
   CASE cPageUp
      PRINT "a page up."
   CASE cPageDown
      PRINT "a page down."
   CASE cEscape
      PRINT "escape."

'>>> Continued on page 2

---
 * Origin: The Radix Point: Astoria, OR (1:105/330.9)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET