home *** CD-ROM | disk | FTP | other *** search
/ Boston 2 / boston-2.iso / DOS / PROGRAM / BASIC / POWBASIC / LIBRARY4 / APLIB.ZIP / AP-LIB.DOC next >
Text File  |  1990-09-08  |  16KB  |  319 lines

  1.  
  2.  
  3.  
  4.              ╔═════════════════════════════════════════════╗
  5.              ║                                             ║
  6.              ║                                             ║
  7.              ║      THE NEW HB ALL-PURPOSE LIBRARY         ║
  8.              ║                                             ║
  9.              ║        FOR POWER-BASIC PROGRAMMERS          ║
  10.              ║                                             ║
  11.              ║       INTRODUCTION AND DOCUMENTATION        ║
  12.              ║                                             ║
  13.              ║                                             ║
  14.              ╚═════════════════════════════════════════════╝
  15.  
  16.  
  17.               Version 2.00000     //    SPRING - SUMMER 1990
  18.  
  19.  
  20.                           ==================
  21.  
  22.    This is my custom routines library, a set of procedures etc. that I have 
  23.    written over a few years time, mostly for my own use in database programs 
  24.    and my custom dos shell. Also I include a do-nothing program intended for 
  25.    demonstration and development of the functions in the library; this also 
  26.    contains detailed how-to instructions (embedded as remarks) to help other 
  27.    programmers use the various library features. 
  28.  
  29.    FEATURES:
  30.     ------
  31.  
  32.       MAIN MENUS ACROSS TOP OF SCREEN AND PULLDOWN SUBMENUS -- WITH
  33.         STANDARD KEYBOARD AND MOUSE CONTROL INTERFACE. 
  34.  
  35.       POP UP AND VANISH MENUS AND DIALOG BOXES, ANYWHERE ON THE SCREEN
  36.  
  37.       INPUT ROUTINES FOR TEXT FIELDS, NUMBERS, DATES ETC. W/ FULL EDITING --
  38.  
  39.       SPECIAL DATE ENTRY ROUTINE THAT "SCROLLS" THE DATE FORWARD OR BACK
  40.       (starting for example with the present date) USING ARROW KEYS 
  41.  
  42.       FULL DATE ARITHMETIC BACK TO 1900. SPECIAL AGE FUNCTION. 
  43.  
  44.       POP-UP DATA ENTRY WINDOWS  -- CURSOR OR TAB BACK AND FORTH FROM
  45.         FIELD TO FIELD
  46.       
  47.       ROUTINES TO GET DISK, DIRECTORY AND SYSTEM INFO DIRECTLY FROM DOS 
  48.  
  49.       ALL IN BASIC FOR RELIABILITY AND EASY MAINTENANCE 
  50.  
  51.       NOW USES SEPARATELY COMPILED POWER-BASIC UNITS. 
  52.  
  53.       NOW SAVES SCREENS DIRECTLY TO MEMORY 
  54.         (used to need a ram-disk, but no more)    
  55.        
  56.  
  57. THE FILES AND WHAT TO DO WITH THEM
  58.    ============================
  59.  
  60.  
  61.      AP-LIB   DOC          The file you're reading now, part of the doc.
  62.  
  63.      APL-QREF BAS          A quick ref guide. I can keep it handy in the Pick 
  64.                            List for quick access (Alt-F3)
  65.  
  66.  
  67.      HBDEMO   BAS          This is the demo. Compile it to an EXE file using
  68.                            Power Basic and you'll see all the tricks these 
  69.                            units and utilities can do. Also contains most of
  70.                            the real documentation for the various procedures
  71.                            & functions (as comments). 
  72.  
  73.      DEMO     SW           The SW files are screen design files for Static  
  74.      DEMO     INC          Windows (display text & data but no user entry). 
  75.      ENTERDEM SW           The INC files are the result of processing them  
  76.      ENTERDEM INC          through the SWW.EXE utility (see below)          
  77.  
  78.      PWDEMO   INC          PW files are design files for PopWindows -- data
  79.      PWDEMO   PW           entry windows. PWW made them into INC files.
  80.  
  81.      SETUP-H  BAS          Header that has to be $INCLUDEd in a program that
  82.                            uses the AP Library
  83.  
  84.      BOXES-U  BAS          |
  85.      FENTRY-U BAS          |
  86.      FIGDAT-U BAS          |    The units comprising the library. 
  87.      INIT-U   BAS          |
  88.      MENUS-U  BAS          |
  89.      MISC-U   BAS          |
  90.  
  91.      HBDEMO   PV           When you have Power Basic units with a lot of 
  92.                            variables you declare as EXTERNAL (i.e. global),
  93.                            each of them must appear in a PUBLIC statement in
  94.                            your main program. I have a utility, PUBVARS, which
  95.                            automatically reads your main program, detects unit
  96.                            names, reads the units and makes you a neatly sorted
  97.                            list (uses the new ARRAY statements) of PUBLIC vars.
  98.                            All the main prog. has to say is "$INCLUDE HBDEMO.PV"
  99.  
  100.      PUBVARS  BAS          |   THREE UTILITIES: PWW and SWW are code generators
  101.      PWW      BAS          |   that create *.INC files for opening the two types
  102.      SWW      BAS          |   of data windows -- one for entry, one just to
  103.      COLORSET.BAS          |   display data (see above). PUBVARS is expained 
  104.                            |   above. NOTE: if you're missing any of the INC
  105.                            |   or PV files, these utilities will recreate them.
  106.                            |   (Of course the best part is that you can modify
  107.                            |   your windows all you want and just reprocess 
  108.                            |   them to get a new display.)
  109.                            |   
  110.                            |   COLORSET automates the process of using command 
  111.                            |   line switches to reset the colors of the Demo
  112.                            |   (or any PB program that uses the SetColors 
  113.                            |   routine). Start it and follow directions! 
  114.                            |   (Thanks to Barry Erick of Spectra support for
  115.                            |   giving his OK to recycle his color selector
  116.                            |   procedure as the kernel of COLORSET.)
  117.  
  118.  
  119.    The program no longer needs a RAM-Disk to save temporary files to!
  120.    Thanks to the new PB functions PEEK$ and POKE$, screens can be quickly
  121.    saved to regular memory space. See SCREENPUSH and SCREENPOP.
  122.  
  123.    There is still an initialization procedure (INIT-U.BAS) which sets
  124.    itself up for any monitor and several types of printer. Works on Mono, 
  125.    CGA and EGA at least. Please note that I have only briefly tried the 
  126.    current version out on a Mono system to see if the COLOR statements are 
  127.    OK, since I don't have one handy any more. 
  128.  
  129.    Many of the SUB procedures -- and even subroutines -- in the old library
  130.    (which was to be $INCLUDE'd, of course, in a TB 1.1 program file) have
  131.    now become true FUNCTION's because that was their true nature. (Shades
  132.    of "C" ! ) Also ... colors are handled differently (as a single integer)
  133.    and can be altered from the command line by command line switches.
  134.    I have a program to generate same, but it's not ready for PB 2.0 yet.
  135.  
  136.  
  137.    So this is what I have so far, if anyone is interested. It works and I
  138.    like it so far. I'll be working on it more, of course, and once it's
  139.    improved I'll do another upload.
  140.          
  141.  
  142.   A NOTE ABOUT STYLE:  You may be horrified at my use of GOTO and GOSUB in  
  143.   ==================   these files. Sorry! I don't like puzzles, I don't care 
  144.          for C, and I see no reason to use contrived outer loops and 
  145.          unnecessary flag variables to avoid a simple, clear and self-evident 
  146.          jump (e.g. GOTO FileSubMenu). And why, I say, incur all the overhead 
  147.          of a SUB procedure, with a ton of SHARED variables to pass, and no 
  148.          local variables at all ... when a GOSUB / RETURN stucture is faster 
  149.          (maybe measurably, maybe no) and does the job perfectly for me and 
  150.          you. 
  151.           
  152.  
  153. ' ============================================================================
  154.   
  155.  
  156.              QUICK REFERENCE FOR HB'S ALL-PURPOSE LIBRARY:
  157.  
  158.                          >>>>>>>>>>>>> in SETUP-H.BAS  <<<<<<<<<<<<<
  159.  DEFINT statement; %False, %True, Register Names and other named const.
  160.  DIM statements
  161.                      ... etc.
  162.  
  163.                           >>>>>>>>>>>>> in INIT-U.BAS  <<<<<<<<<<<<<
  164.  
  165. SUB Initialize (PrinterType) PUBLIC (reads hardware, sets printer codes etc.)
  166.  
  167.                           >>>>>>>>>>>>> in FENTRY-U.BAS  <<<<<<<<<<<<<
  168.  
  169. SUB ENTERSTRING (Wkg$,FLength,Opt$) PUBLIC      |  These are the Formatted
  170. SUB ENTERNUMBER  (Wkg#, Masq$, Opt$) PUBLIC     |  Entry routines
  171. SUB ENTERDATE  (A$, Opt$) PUBLIC                |
  172. SUB RotaDate  (D$,Opt$) PUBLIC                  |
  173. SUB ENTERTIME  (A$, Opt$) PUBLIC                |
  174. SUB ENTERSSN  (A$, Opt$) PUBLIC                 |
  175. SUB ENTERPHONE  (A$, Opt$) PUBLIC               |
  176.  
  177. SUB PressAKey PUBLIC           Displays a little box that says Press A Key
  178.                                If you have mouse, says you may also Click
  179.  
  180. FUNCTION GetYesOrNo PUBLIC     Prints "y/n" and waits til you answer with
  181.                                an appropriate key or mousebutton (Left = Yes)
  182.  
  183. SUB ENTERYESNO  (Yes) PUBLIC   Prints a field with a Y or N in it; press
  184.                                Y or N or [Enter]. Used in data entry windows.
  185.  
  186.  
  187.                              >>>>>>>>>>>>> in BOXES-U.BAS  <<<<<<<<<<<<<
  188.  
  189. SUB BOXMESSAGE(CornerLin, CornerCol, Margin) PUBLIC
  190. SUB BOXMESSAGE2 (CornerLin, CornerCol, Margin, I$(1), Items%, Maxx) PUBLIC
  191.                            (prints a box, with lines of text you specify in it.)
  192.  
  193. SUB POPWINDOW  PUBLIC
  194. SUB PWSetUp (Fld$,Z) PUBLIC
  195.                            (prints a window with entry fields in it and
  196.                             readies it for data entry)
  197.  
  198. SUB QBOX (L, C, Lines%, Message$, AnsFldLength) PUBLIC  (one-field dialog box)
  199.  
  200.                              >>>>>>>>>>>>> in MENUS-U.BAS  <<<<<<<<<<<<<
  201.  
  202. SUB TOPMENU (Lines% ,Choice, TLine$) PUBLIC
  203.                          Top of screen menu; select with letter
  204.                          key, cursor and CR, or click and      
  205.                          pull-down with your Furry Friend.     
  206.  
  207. SUB POPMENU (TopKey$,MenuRight,MenuDown,Choice,MLine$,MCode$) PUBLIC
  208.                                  (retained only for compatibility with old code)
  209.  
  210. SUB SUPERMENU (MenuData$$ (), MenuRight, MenuDown, Choice, Title$, Ky%) PUBLIC
  211.                          Regular moving-bar menu with mouse or keybd selection,
  212.                          optional pulldown style or multipage styles, optional
  213.                          help lines that appear in line 25.
  214.  
  215.                              >>>>>>>>>>>>> in FIGDAT-U.BAS  <<<<<<<<<<<<<
  216.  
  217.  FUNCTION FigDate&(A$) PUBLIC          convert a date to a "Julioid" long-int
  218.  FUNCTION WriteDate$ (W&) PUBLIC       convert the other way
  219.  FUNCTION WkDay$(W&) PUBLIC            what day of the week is a given date
  220.  FUNCTION YearsSince (D0$) PUBLIC      how old is a client born on D0$
  221.  
  222.  FUNCTION FlipDate$ (WrittenDate$) PUBLIC      rearrange date for sorting
  223.                                                  or indexing (e.g. 900829)
  224.  FUNCTION UnflipDate$ (FlippedDate$) PUBLIC    unrearrange date
  225.  
  226.                              >>>>>>>>>>>>> in MISC-U.BAS  <<<<<<<<<<<<<
  227.  
  228. SUB SCREENPUSH PUBLIC                 |
  229. SUB SCREENPOP PUBLIC                  |  screen save & restore
  230. SUB RestoreDOSScreen PUBLIC           |
  231.  
  232. SUB PRINTLINE (L$) PUBLIC    (fancy printer control -- keep track of pages etc.)
  233.  
  234. SUB FileFunctions (MenuRight, MenuDown, Choice$) PUBLIC
  235.                      (A smart Menu that gives choices like SAVE, FIND, CLEAR --
  236.                       but only as applied to the field cursor is on)
  237.  
  238. FUNCTION IsBlank (W$) PUBLIC        (is W$ a nul string or nothing but spaces?)
  239. FUNCTION GetAttr PUBLIC             (what is the color at the cursor ??)
  240. FUNCTION IsRodent PUBLIC        ' finds if you have a rodent and also resets it
  241. SUB Mouse(MV1, MV2, MV3, MV4) PUBLIC
  242. FUNCTION GetCurrentDrive$ PUBLIC
  243. FUNCTION GetCurrentDir$ PUBLIC
  244. FUNCTION GetFreeSpace! (Drv$) PUBLIC
  245. FUNCTION ReadParamFor (A$) PUBLIC ' this reads parameters from the command tail
  246. SUB ClearLine PUBLIC
  247. SUB DirFirst (F$, FileSize&, DateCode&, TimeCode&) PUBLIC
  248. SUB DirNext (F$, FileSize&, DateCode&, TimeCode&) PUBLIC
  249. FUNCTION DecodeDate$ (DateCode&) PUBLIC
  250. FUNCTION DecodeTime$ (TimeCode&) PUBLIC
  251.  
  252.  
  253. ===============================================================================
  254.  
  255.  
  256. SUB BOXMESSAGE(CornerLin, CornerCol, Margin)  'Boxes and displays your message.
  257.    ====                   Top L. corner will be at the designated coordinates,
  258.                           but errors are trapped so box will stay on the
  259.                           screen regardless. The message line should appear
  260.                           in your code as DATA statements, terminated by
  261.                           "END". A RESTORE statement is needed, of course.
  262.                           See HBDEMO2.BAS for examples & comments.
  263.  
  264.  
  265. SUB ENTERSTRING (Wkg$,FLength,Opt$)
  266.    =======          This routine provides a field at Ln, Col for the operator
  267.                     to enter data into. Wkg$ is the current value of the field.
  268.                     FLength = length of field. Opt$ may be "" or may hold
  269.                     the strings "Cap" for all uppercase, "Auto" for automatic
  270.                     entry when full, "UpOut" or "BackOut" if UpArrow or Left/
  271.                     backspace keys are to be able to end entry.
  272.          On exiting sub, Opt$ may be reset as Left, Auto, Up, Down, ESC or CR.
  273.          At any time during string entry the operator can press [CR] or DOWN-
  274.          ARROW to enter;  [F2] is pressed for Database Function commands
  275.          (Clear, Find, Next/Prev, View Notes, Save) implemented below ...
  276.                not to mention the groovy pop-up data entry windows ...
  277.          2-4-89: Now supports: Ins default (in Opt$), ^Y, ^T, and ^Arrow
  278.                  Negative numbers not allowed unless Opt$ includes a "-"
  279.  
  280.  
  281.                          *** HOW TO USE SUPERMENU ***
  282.                               ===================
  283.  
  284.         MENU SETUP: THE MenuData$$ ARRAY:
  285.            Each choice on your menu is represented by one string element in
  286.            this array. The decription of each choice -- for example, "LOAD",
  287.            will start with the third character of this string. If you are
  288.            specifying the hot-key for each choice put it into the first
  289.            character -- set MenuData$$ (1) as something like "L LOAD". To let
  290.            the software number or letter the items in order for you, set
  291.            MenuData$$ as just "  LOAD". (If there are <11 items, numbers
  292.            are used rather than letters.) After the last menu item, you
  293.            must set the next array element as "END".
  294.         PASSING HELP LINES TO MENU: Set MenuHelpLine$() to contain lines (up
  295.            to 80 chr long) to appear at screen bottom whenever the
  296.            corresponding menu choice is highlighted.
  297.         POSITION OF MENU ONSCREEN ETC.: MenuRight moves it right or left -- 0
  298.            is top center. MenuDown moves it -- you guessed it! Errors will be
  299.            trapped. Vertical centering is gotten by setting MenuDown = 25.
  300.            Usually set Choice = 1.  Title$ is title of menu.
  301.  
  302.  *** AFTER MENU ROUTINE: Choice will hold the choice #. Title$ reset to "".
  303.            MKeyPressed$ if the actual key used (if mouse was used it
  304.            simulates the CR key, i.e. CHR$(13)) -- or if [ESC] or a legal
  305.            function key was pressed it contains "ESC", "PgDn", "PgUp", "F1",
  306.            or "F2".
  307.  
  308.  
  309.     THIS IS INTENDED AS A DEVELOPMENT TOOL FOR PROGRAMMERS. IF YOU LIKE IT,
  310.                               PASS IT ON.
  311.  
  312.       Your feedback is welcomed -- write to 2097 7th St. in
  313.       Oakland, Ca. 94607 --  or via the CompuServe PCVENB
  314.       Forum (# 71121,776), or Pro-Net or MOE in the Bay Area.
  315.  
  316.       -- Howard Ballinger
  317.  
  318.  
  319.