Dec 222017
 
This is a routine for quickbasic 4.5. It inputs dates, phone numbers, and zip codes, and is editable. (like Christy Gemmell's Revinput routine). I wrote this because I could not fine exactly what I needed.
File GETNUM.ZIP from The Programmer’s Corner in
Category BASIC Language
This is a routine for quickbasic 4.5. It inputs dates, phone numbers, and zip codes, and is editable. (like Christy Gemmell’s Revinput routine). I wrote this because I could not fine exactly what I needed.
File Name File Size Zip Size Zip Type
GETNUM.DOC 10330 2997 deflated
GETNUM.LIB 17935 7827 deflated
GETNUM.OBJ 16912 7768 deflated
GETNUM.QLB 15706 7296 deflated
TPCREAD.ME 199 165 deflated

Download File GETNUM.ZIP Here

Contents of the GETNUM.DOC file


=========================================================================================
Getnum.bas : Phone, Date, and Zip Code input routines for QuickBasic 4.5.
=========================================================================================

To print this file, make sure your printer is set to
12 CPI. ( 3 pages )

This routine was written using pure QuickBasic 4.5.
You are free to use this code provided the following
conditions are met.
1. The first DATA statement is left intact come
compile time.
2. see number 1.

The files contained in this package are:
+/- 0
getnum.arj 28165 03-01-93 12:00:00a - The archive
getnum.doc 10330 03-01-93 12:00:00a - This file
getnum.lib 17935 03-01-93 12:00:00a - a QuickBasic 4.5 library file
getnum.qlb 15706 03-01-93 12:00:00a - a Quickbasic 4.5 quick library
getnum.obj 16912 03-01-93 12:00:00a - an object file for merging with
your library

Note: If the file sizes and dates and times do not match the directory listing,
You definately have a hacked copy.

scope:
This is not intended as a tutorial on bc, link, or lib.
If you have no idea what I mean by the above line,
sit down with your QuickBasic 4.5 manual, turn to page
349 and start reading.

The source code ( Not included with this package )
is fully documented and available seperately ( see
the last 7 lines of this document ).

It is probably not the tightest ( QB 4.5 ) code possible,
But it started out at 22 typed pages ( before I could get
it all to work ), and is now 12 pages. ( Many hours of
sitting in front of this screen.)

I hope this routine does for you what you want it to,
regardless of whether or not it does, Please drop me a
line and let me know your thoughts and/or sugestions.

Warranty:
NONE, this code is provided as is ( What do you expect,
after all, it is basically free ).

The Nitty Gritty:
'=========================================================================================
' getnum.bas By Jay Marton March 1993
'=========================================================================================
DECLARE SUB getnum (number$, u%, w%, ncf%, ncb%, hcf%, hcb%, elx%, ely%, ecf%, ecb%, ecc%)
'======================================================================================
' usage: First use the locate statement to set where you want the
' beginning of the field
' CALL getnum(number$, u%, w%, ncf%, ncb%, hcf%, hcb%, elx%, ely%, ecf%, ecb%, ecc%)
' where number$ is the initial number to use. ( see w% returns below )
' u% 0 = do not use initial number & return unformatted string
' 1 = use initial number & return unformatted string
' 3 = do not use initial number & return formatted string
' 4 = use initial number & return formatted string
' w% 0 - 10 = the format for the returned number string
' ncf% = the fields normal foreground color
' ncb% = the fields normal background color
' hcf% = field active foreground color
' hcb% = field active background color
' elx% = error message x location (down)
' ely% = error message y location (over)
' ecf% = error message foreground color
' ecb% = error message background color
' ecc% = color used to clear error message
'--------------------------------------------------------------------------------------
' the return values are as follows:
'--------------------------------------------------------------------------------------
' number$ = 5 to 16 character number string, dependent on w%
'--------------------------------------------------------------------------------------
' if u% is set to 1 or 2 then the field "picture" will remain as
' below, but the returned string will be pure integers.
' If u% is set to 3 or 4 then
' w% will print & return the number as follows: number$ =
' 0 = " - " - 7 digit formatted phone number
' 1 = " " - 10 digit unformatted phone number
' 2 = "( ) - " - 10 digit formatted phone number
' 3 = "1-( ) - " - 10 digit formatted phone number
' 4 = "1-( )- - " - 10 digit formatted phone number
' 5 = " " - 6 digit unformatted date
' 6 = " - - " - 6 digit formatted date
' 7 = " \ \ " - 6 digit formatted date
' 8 = " / / " - 6 digit formatted date
' 9 = " " - 5 digit zip code
' 10 = " - " - 9 digit extended zip code
'--------------------------------------------------------------------------------------
' u% will return the following values:
'--------------------------------------------------------------------------------------
' 1 = no save - escape key used to exit| 5 = page up key used to exit
' 2 = "F2" key used to exit | 6 = page down key used to exit
' 3 = up arrow key used to exit | 7 = save & exit via the enter key.
' 4 = down arrow key used to exit | 8 = Too close to right margin
' 9 = bad error message location (0,0 or same as #8)
' 10 = bad u% entry (not 0, 1, 3, or 4)
'--------------------------------------------------------------------------------------
' Note: The supplied string must not formatted as above when passing
' it to this sub, But it can be returned formatted as above via u%.
' This sub also does some checks ( i.e. valid leap year { assumes
' year between 1951 to 2050 }, day, month, etc... ) and reports errors.
' This file can be printed at 12 CPI on 8" wide paper.
'--------------------------------------------------------------------------------------

'--------------------------------------------------------------------------------------
' An example of how I use this:
' 5 : ' this is field #5, and I need to know where this
' ' position is in case of arrow keys, etc.
' LOCATE 5, 49 ' this is where I want the field.
' z% = 5 ' this is to let testkey gosub know where I am
' u% = 4 ' getnum - use existing number & reformat? yes.
' w% = 4 ' getnum - which format? format #4 (see above)
' ' format the string so getnum can use it:
' number$ = work$ 'i.e. work$ = "6035551212"
' ' normal color - yellow on black
' ' hilite color - black on grey
' ' error message at row 7, column 49
' ' error message color - yellow on red
' ' normal color at error message location - blue
' CALL getnum(number$, u%, w%, 14, 0, 0, 7, 7, 49, 14, 4, 1)
' ' number$ now = "1-(603)-555-1212", (if not edited)
' work$ = number$
' ' make the return code compatable with Christy Gemmell's
' ' (co-author of "The Quickbasic Bible") revinput routine
' ' (Assembly language toolbox) parameter hotkey%.
' hotkey% = u%
' ' a gosub which controls which field to go to next.
' GOSUB testkey ' which uses the value of hotkey%
'--------------------------------------------------------------------------------------
' Uncomment the following 16 lines and run to debug:
'COLOR 14, 1: CLS
'ecc% = 1 ' Error message clear color.
'number$ = "022993" ' An initial number.
'u% = 4 ' Use initial number?
'w% = 8 ' Which format?
'LOCATE 1, 4
'PRINT " -------------------------- Exit codes via u% : -------------------------------"
'PRINT " 1 = escape 2 = F2 3 = up arrow 4 = down arrow 5 = page up "
'PRINT " 6 = page down 7 = enter key 8 = Too close to right margin"
'PRINT " 9 = bad error message location 10 = bad u% entry (not 0, 1, 3, or 4)"
'PRINT " ------------------------------ w% is set to"; w%; "--------------------------------"
'LOCATE 11, 10: PRINT " This is the actual field : ";
'CALL getnum(number$, u%, w%, 0, 0, 0, 0, 12, 11, 0, 0, ecc%)
'COLOR 14, 1
'LOCATE 13, 10: PRINT " The returned number string is : "; number$
'LOCATE 14, 10: PRINT " The returned value of u% ( exit code ) is : "; u%
'-----------------------------------------------------------------------------------------
' If you use this code in your programs, Please leave the first DATA statement
' alone. If you modify the actual code, do as you wish. Thanks.
'-----------------------------------------------------------------------------------------
DATA " Getnum.bas: Phone, Date, and Zip Code input routines. By Jay Marton. March 1993."
DATA " You are free to use this code in your programs as long as my name and the "
DATA " date remain within YOUR DATA statements. Pure Quickbasic Source code is "
DATA " available on disk for $14.00 + SASE (Latest .Bas, Qlb, Lib, and .Obj) "
DATA " Please specify disk capacity. Or the latest .Bas source typewritten for
DATA " $10.00 + SASE (12 Well Documented Printed Pages) from me at the following : "
DATA " Jay Marton 70 Winter St. Apt. 1A Somersworth, NH. 03878 "



 December 22, 2017  Add comments

Leave a Reply