home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 15 / CDACTUAL15.iso / cdactual / program / basic / PSCRN42.ZIP / ROUTINES.DOC < prev    next >
Encoding:
Text File  |  1990-09-02  |  33.1 KB  |  761 lines

  1.  
  2.  
  3.  
  4.          P-Screen Professional (tm)
  5.  
  6.  
  7.  
  8.  
  9.          Supplementary Quick Reference Guide to:
  10.  
  11.  
  12.             QuickBASIC Subroutines Included with P-Screen Professional
  13.  
  14.             PDS 7 Subroutines Included with P-Screen Professional
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.          +---------- For information or support, call or write -----------+
  35.          |                                                                |
  36.          | Pro~Formance    132 Alpine Terrace   San Francisco, Ca.  94117 |
  37.          |                                                                |
  38.          |       Phone:    (415) 863-0530  (10-5 Pacific time please)     |
  39.          |                                                                |
  40.          |                                                                |
  41.          |   Your feedback, suggestions and comments are always welcome.  |
  42.          +----------------------------------------------------------------+
  43.  
  44.  
  45.  
  46.              Copyright (C) 1988-1989, Rob W. Smetana and Pro~Formance
  47.  
  48.  
  49.  
  50.  
  51.          P-Screen, it's manual and supporting materials are protected by
  52.          U.S. and International Copyright Laws.   All Rights Reserved.
  53.  
  54.          P~F Screen Design, P-Screen, P-Screen Professional, P~F Presents,
  55.                   PFP, Pro~Formance, and P~F are Trademarks of:
  56.                          Rob W. Smetana & Pro~Formance
  57.  
  58.  
  59.                                                                               
  60.                                   Overview
  61.                                   ========
  62.  
  63.          This supplementary manual explains how to call our subroutines
  64.          from QuickBASIC or PDS 7 programs.  We send these routines to
  65.          registered users of P-Screen Professional.  These routines are
  66.          included in PS-Demo.Qlb and BC7-Demo.Qlb to help you run two
  67.          demo programs we've included:  Employee.Bas and Toorder.Bas.
  68.  
  69.          We'll first summarize each routine.  We'll then explain how to
  70.          use each routine.
  71.  
  72.                                 IMPORTANT NOTES
  73.                                 ===============
  74.  
  75.           * PDS 7 routines have names starting with "7."  So, for
  76.             example, "7rsMinpt.Obj" is the PDS 7 version of rsMinput.
  77.             The QuickBASIC version is "rsMinput.Obj"
  78.             - ONLY the "string" routines differ between PDS 7 and
  79.               QuickBASIC 4.x.  That's because the PDS 7 routines were
  80.               compiled with the "/fs" switch (FAR STRING).
  81.             - If your PDS 7 programs DON'T use Far Strings, use the
  82.               QuickBASIC versions rather than the "7" versions.
  83.             - Use the SAME "screen restore" routines in QB or PDS 7.
  84.  
  85.             QuickBASIC
  86.               Version              Purpose              PDS 7 Version
  87.             ===========       ------------------        =============
  88.             rsMinput.Obj      User Input Routine        7rsMinpt.Obj
  89.             LoadScrn.Obj      Screen Library Load       7LdScrn.Obj
  90.             PropName.Obj      Text "Proper Name"        7PropNam.Obj
  91.             FmtUsing.Obj      Format #s for printing    7FmtUse.Obj
  92.             rsQprint.Obj      Assembler "Quick" print   7rsQprt.Obj
  93.  
  94.           * rsMinput.obj contains 4 other subroutines: OneKey, Mask,
  95.             StripMask and StripTrail.
  96.  
  97.           * rsMinput REQUIRES rsQprint to handle text printing.  If you
  98.             link rsMinput to your programs, you must also link rsQprint.
  99.  
  100.           * ALL numeric variables MUST be integers (except in FormatUsing).
  101.             If you do otherwise, these routines will crash.
  102.  
  103.                          Adding Subroutines to your Programs
  104.                          ...................................
  105.  
  106.          You can add these subroutines to your programs in one of two ways.
  107.          The easiest is to add these subroutines to any library you use
  108.          with QuickBASIC.  Then create a Quick Library out of the ".LIB"
  109.          file.  This allows you to call the routines from QB's editor
  110.          while you're testing your programs.  Here's how:
  111.  
  112.          Alternative 1
  113.          .............
  114.  
  115.              Lib MyLib +rsMinput +rsQprint +rsCmpRst +FmtUsing +PropName;
  116.                  (this adds our routines to your ".LIB" file MyLib)
  117.  
  118.              Link /q/seg:256 MyLib.Lib, MyQuick.Qlb, , bqlb45;
  119.                  (this creates a QuickBASIC Quick Library out of MyLib.Lib)
  120.                  (you must include ".Lib" or Link assumes you mean ".Obj")
  121.  
  122.              - Replace "MyLib" and "MyQuick" with the names of your
  123.                library and Quick library, respectively.
  124.  
  125.           Next, compile your program and link it to your library.
  126.  
  127.              bc MyProg /o;
  128.              Link MyProg, , BCom45 + MyLib /exe;
  129.  
  130.  
  131.          Alternative 2
  132.          .............
  133.  
  134.          In this alternative, you don't add routines to libraries.
  135.          Instead you compile your program, then link it to one or more
  136.          of the ".obj" files we sent you.  For example:
  137.  
  138.              bc MyProg /o;
  139.              Link MyProg +rsMinput +rsQprint , ,BCom45 /exe;
  140.  
  141.                                                                              
  142.          1                  Overview of Subroutines
  143.                             =======================
  144.  
  145.          Routine Name   Purpose
  146.          ============   ==================================================
  147.  
  148.          rsMinput       Handle ANY type of user input:  A single key (like
  149.                         a menu choice), a full 80 columns of text, function
  150.                         keys, cursor pad keys, file names, anything!
  151.                         - rsMinput REQUIRES rsQprint (to handle printing).
  152.                         - "M" means Mask.  rsMinput will format data entry
  153.                           using a mask you supply.  For example, for Phone
  154.                           Numbers, use a mask like (...) ...-....  rsMinput
  155.                           accepts input where "." appears, and automatically
  156.                           skips over parentheses, spaces, hyphens, etc.
  157.                         - You specify the Length of each field (# of charac-
  158.                           ters) and which keys are Valid (eg., numbers only,
  159.                           A-D for 4 menu choices, upper case for file names).
  160.                         - You can ask rsMinput to exit on "extended keys,"
  161.                           and report which one was pressed.  This might
  162.                           include function keys, cursor pad keys, Alt-key
  163.                           combinations, etc.
  164.                         - P-Screen uses rsMinput to handle every key you press!
  165.  
  166.          OneKey         Gets one key from the user -- a menu choice, cur-
  167.                         sor pad or function keys, etc.  You specify which
  168.                         keys are "valid."
  169.  
  170.          Mask &         Used by rsMinput for "formatted input," you can
  171.          StripMask      also call Mask directly to print formatted text.
  172.  
  173.          StripTail      Strips any character from the end (tail) of
  174.                         text strings.  StripTrail is particularly useful
  175.                         for striping Null characters (Chr$(0)) from
  176.                         file records.
  177.  
  178.          rsQprint       Assembler routine to quickly print text on the
  179.                         screen. You tell it where to print (row & column),
  180.                         which color to use, and which string to print.
  181.  
  182.          FormatUsing    Converts a number into a "formatted" string for
  183.                         editing or printing.  It includes ALL of BASIC's
  184.                         "Print Using" options to insert dollar signs,
  185.                         commas, decimal points, etc. -- at your option.
  186.  
  187.  
  188.          ProperName     Type "john smith" or "san francisco" and ProperName
  189.                         returns it properly capitalized (ie., it returns
  190.                         "John Smith" and "San Francisco").  Speeds typing.
  191.  
  192.  
  193.          Exist          A QuickBASIC function to tell if files exist
  194.                         (before you try to open or write over them).
  195.                         Helps eliminate the need for "On Error."
  196.  
  197.  
  198.                                                                               
  199.          3
  200.  
  201.                              Subroutine:       rsMinput
  202.                              ..........................
  203.  
  204.          rsMinput handles virtually any type of user input:  a single key,
  205.          a full 80 columns of text, extended keys (function keys, cursor
  206.          pad), printer control codes, etc.  It will also "mask" data input
  207.          (thus the "M"), giving you formatted input for things like phone
  208.          numbers and Zip Codes.
  209.  
  210.          Calling format
  211.          ..............
  212.  
  213.          Locate Row%, Column%
  214.          Call rsMinput (Text$, Valid$, Exit$, Msk$, Length%, RetCode%,  _
  215.                         Colr%, HiLite%)
  216.  
  217.               Notes:       - We must "Locate Row, Column" before calling.
  218.                            - Call rsMinput with 8 variables (4 strings
  219.                              and 4 integers)
  220.                            - Two variables (Exit$ and RetCode%) have "Double
  221.                              Duty" -- they mean one thing when you call
  222.                              rsMinput, and rsMinput changes them on exit
  223.                              letting you know how the user exited.
  224.                              Because they're changed, you MUST initialize
  225.                              them each time you call rsMinput.
  226.  
  227.          Variable          Purpose
  228.          ============      ==================================================
  229.  
  230.                 Text$      Is the string you want to edit.
  231.                            - If it's blank, you can enter new text
  232.                            - If there's something there, you can edit
  233.                              it or add to it
  234.                            The maximum length is 80 characters.
  235.  
  236.                 Valid$     Is a list of "valid" keys the user may press.
  237.                            - This could include ANY keyboard character, PLUS
  238.                              all extended codes PLUS low/high Ascii characters.
  239.                            - Or, it could include just numbers.
  240.                            - Or, it could be 5 letters corresponding to 5
  241.                              menu choices.
  242.                            rsMinput processes only Valid keys (plus Exit$
  243.                            keys and <cr> and Esc).  It ignores all other keys.
  244.                                                                              
  245.  
  246.          4  rsMinput (continued)
  247.  
  248.          Variable         Purpose
  249.          ============     ==================================================
  250.  
  251.               Exit$       rsMinput normally exits when <cr> (Enter) or Esc
  252.                Double     is pressed.  If you want rsMinput to exit when
  253.                Duty       other keys are pressed, list them in Exit$.
  254.                           - On Input:  Assign "key codes" to Exit$ telling
  255.                             rsMinput which other keys to exit on.  This can
  256.                             include function keys, cursor pad keys, etc.
  257.                             -- The screens "CursAlt" and "Function" in
  258.                                P-Screen.Psl list almost all key codes you need.
  259.                             -- Most of these keys return two bytes (Chr$(0)
  260.                                plus a scan code).  List ONLY the scan code.
  261.                             -- Example:  Exit$ = ";" + Chr$(16)  to tell
  262.                                rsMinput to exit if F1 or Alt-Q is pressed.
  263.                           - On Exit:  Exit$ = the last key pressed.  This
  264.                             could be <cr> (Chr$(13), Esc (Chr$(27)), or F1 (;).
  265.                             -- Note, we strip the leading Chr$(0) from F1.
  266.                             -- You can test Exit$ to see what action to take.
  267.                                See RetCode% for an alternative.
  268.  
  269.                   Msk$    This is a "mask" rsMinput uses for masked or
  270.                           formatted editing.
  271.                           - A mask is optional.  If it's null or blank,
  272.                             input won't be formatted.
  273.                           - Example:
  274.                             Msk$ = "Enter a phone number: # (###) ###-####"
  275.                           - Msk$ works something like BASIC's Print Using.
  276.                             You enter "#" wherever you want data, other
  277.                             characters as a text prompt or for formatting.
  278.                           - Unlike Print Using: 1) Msk$ works with numbers
  279.                             OR text; and, 2) the mask may have up to 79
  280.                             characters (unlike Print Using's 24).
  281.                           - rsMinput waits for input wherever you put "#".
  282.                             It skips over everything else.
  283.                           - rsMinput strips the mask on exit, returning to
  284.                             you just the edited text.
  285.  
  286.  
  287.                Length%    This is the maximum length you'll accept (ie.,
  288.                           the number of characters).
  289.                           - If Length% = 1, rsMinput exits immediately when
  290.                             one of the VALID$ keys is pressed (See below)
  291.                           - If you forget (LIMIT%=0), you get 1 char. back
  292.                           - If you send down a mask, the number of "#"
  293.                             in the mask overrides Length.
  294.  
  295.                                                                            
  296.  
  297.          5  rsMinput (continued)
  298.  
  299.          Variable          Purpose
  300.          ============      ==================================================
  301.  
  302.              RetCode%      On Input:
  303.               Double       - Set RetCode% equal to the Ascii code of the
  304.                Duty          character you want blank areas of the field
  305.                              filled with (useful for highlighting fields).
  306.                              -- We use RetCode% = 32 (Ascii code for
  307.                                 Space), then use Hilite% to highlight the
  308.                                 field we're editing.  But you can use ANY
  309.                                 Ascii character (try 176, 250, 196 and 240).
  310.                            - If on entry RetCode% is NEGATIVE, rsMinput
  311.                              capitalizes all user input.  (eg. -32).
  312.  
  313.                            On Exit:
  314.                            - RetCode% = -27 or -13 if Esc or <cr> was pressed.
  315.                            - If one of your Exit$ keys was pressed, RetCode%
  316.                              returns equal to it's order in Exit$.  For
  317.                              example, if Exit$ = ";" + Chr$(16), and the
  318.                              user pressed Alt-Q, RetCode% would be 2.
  319.  
  320.                 Colr%/     Colr% is the color you want the field restored
  321.                HiLite%     to on exit.  HiLite% is the color you want
  322.                            during editing.
  323.                            - Both colors are integers containing BOTH
  324.                              foreground and background attributes.
  325.                            - Use this formula to calculate each:
  326.                                   (Back% And 7) * 16 + Fore%
  327.                              where "Back%" is the background, and "Fore%"
  328.                              is the foreground color you want.  This
  329.                              formula can't create blinking colors.
  330.  
  331.  
  332.          Notes on using rsMinput
  333.          .......................
  334.           * Notice you have 2 ways to highlight the field during editing.
  335.             - Use color by setting HiLite% to a contasting color (reverse?).
  336.             - Or, set RetCode% equal to some interesting looking character.
  337.             - Or, do both.
  338.  
  339.           * rsMinput has FULL EDITING KEY capability.  The screen "EditHelp"
  340.             in P-Screen.Psl summarizes rsMinput's editing features.   Feel
  341.             free to include this screen in your programs.
  342.             - Be sure to notice Alt-U (undo)
  343.             - Also note that certain keys are needed for editing.  So you
  344.               can't include them in Exit$. (left/right cursor, home, end,
  345.               delete-to-end, delete Line, next word, last word, insert)
  346.  
  347.                                                                            
  348.  
  349.          6  rsMinput, Examples
  350.  
  351.          Here are some examples showing how to initialize and call rsMinput.
  352.  
  353.  
  354.          rsMinput Example 1
  355.          ..................
  356.          '--- 1st, define a function to easily handle color calculations
  357.  
  358.          Def FnColr%(Fore%,Back%) = (Back% And 7) * 16 + Fore%
  359.  
  360.          Msk$ = "##### - ####"         'format this as a zip code
  361.          Exit$ = ";<=>"                'exit on F1, F2, F3 or F4
  362.          Valid$ = "1234567890"         'accept numbers only for zip code
  363.          RetCode% = 32                 'pad the field with spaces
  364.          Colr% = FnColr% (7, 1)        'restore color to White on Blue
  365.          Hilite% = FnColr% (0, 7)      'while editing, use Black on White
  366.  
  367.          Locate 12, 25
  368.          Call rsMinput (Text$, Valid$, Exit$, Msk$, Length%, RetCode%,  _
  369.                         Colr%, HiLite%)
  370.  
  371.          Select Case RetCode%
  372.            Case -13                    'Enter pressed
  373.              ...do something
  374.            Case -27                    'Esc pressed
  375.              ...do something
  376.            Case 1                      'F1 pressed  (1st character in Exit$)
  377.              Gosub DisplayHelp
  378.            Case 2                      'F2 pressed  (2nd character in Exit$)
  379.              ...do something
  380.            Case 3                      'F3 pressed         etc.
  381.              ...do something
  382.            Case 4                      'F4 pressed
  383.              ...do something
  384.            Case else
  385.          end select
  386.  
  387.  
  388.          rsMinput Example 2
  389.          ..................
  390.          In this example we "hardcode" -- Length%, Colr%, and HiLite%.
  391.          Also notice Msk$ is nul ("").
  392.  
  393.          Exit$ = "D"                   'exit on F10
  394.          Valid$ = AnyChar$             'accept any keyboard character
  395.          RetCode% = -250               'pad with Chr$(250) AND capitalize it
  396.  
  397.          Locate 8, 55
  398.          Call rsMinput (Text$, Valid$, Exit$, "", 80, RetCode%, 23, 112)
  399.  
  400.          Select Case RetCode%
  401.            Case 1                      'F10 pressed
  402.            .
  403.            .
  404.            Case else
  405.          End Select
  406.                                                                         
  407.  
  408.          7  rsMinput, Examples (continued)
  409.  
  410.          rsMinput Example 3
  411.          ..................
  412.          In this example we only want cursor pad keys -- no text editing.
  413.          Text$, Valid$, Msk$ are all null, we want only 1 key, and Colr%
  414.          and Hilite% are the same (and irrelevant).  We could also
  415.          "Call OneKey ...." -- a more efficient way to get just 1 key.
  416.  
  417.          Exit$ = "GHIKMOQ"             'extended codes for cursor pad keys
  418.  
  419.          Locate 25, 79
  420.          Call rsMinput ("", "", Exit$, "", 1, RetCode%, 112, 112)
  421.  
  422.          Select Case RetCode%
  423.            Case 1                      'Home pressed
  424.            Case 2                      'Up Cursor pressed
  425.            .
  426.            .
  427.            Case 7                      'PgDn pressed  (7th character in Exit$)
  428.            .
  429.            .
  430.            Case else
  431.          End Select
  432.                                                                              
  433.  
  434.  
  435.          8                   Subroutine:       OneKey
  436.                              ........................
  437.  
  438.          OneKey calls rsMinput.  It's designed to get 1 key from the user
  439.          (a menu choice, Yes/No, function keys, cursor pad keys, etc.).
  440.           * Calling OneKey is simpler than calling rsMinput, since we know
  441.             we want just one key, and Msk$ is irrelevant.
  442.           * Text$, Valid$, Exit$, RetCode%, Colr%, and HiLite% work the
  443.             same in OneKey as in RsMinput.
  444.           * OneKey ALWAYS capitalizes Text$ on exit.  So, be sure to set
  445.             up Valid$ with ONLY upper case letters.
  446.  
  447.          Calling format
  448.          ..............
  449.          Locate Row%, Column%
  450.          Call OneKey (Text$, Valid$, Exit$, RetCode%, Colr%, HiLite%)
  451.  
  452.               Notes:       - How you set up Text$ before entry determines
  453.                              whether OneKey prints the character pressed.
  454.                              -- If Text$ is null ("") OR Chr$(0), we
  455.                                 WON'T print any keys pressed.
  456.                              -- If Text$ is a space (" ") or a character,
  457.                                 we WILL print it.
  458.                            - Call OneKey with 6 variables (3 string and
  459.                              3 integer variables)
  460.                            - Two variables (Exit$ and RetCode%) have "Double
  461.                              Duty" -- they mean one thing when on entry,
  462.                              another on exit (the same as rsMinput).
  463.  
  464.          Refer to the section on rsMinput for an explanation of variables.
  465.  
  466.  
  467.          OneKey Example 1
  468.          ................
  469.          Text$ = " "                   'we DO want user input printed
  470.          Valid$ "ABCD"                 '4 menu choices (note Upper Case!)
  471.          Colr% = 23                    'restore color to White on Blue
  472.          Hilite% = 112                 'while editing, use Black on White
  473.  
  474.          Call OneKey (Text$, Valid$, "", RetCode%, Colr%, HiLite%)
  475.  
  476.          On Instr (Valid$, Text$) Gosub Do.A, Do.B, Do.C, Do.D
  477.  
  478.          (if Enter or Esc is pressed, we'll fall thru "On Instr..." to here)
  479.  
  480.                                                                            
  481.  
  482.  
  483.          9
  484.  
  485.          OneKey Example 2
  486.          ................
  487.          Here we just want function keys (so Text$ & Valid$ are null).
  488.          We end on Esc.  Note both colors are 0.  They're irrelevant
  489.          since we won't print user input (because Text$ = "").
  490.  
  491.          Do Until RetCode% = -27          'loop until you press Esc
  492.  
  493.             FunctionKey$ = ";<=>?@ABCD"   'the screen "Function" gave us these
  494.  
  495.             Call OneKey ("", "", FunctionKey$, RetCode%, 0, 0)
  496.  
  497.             Locate 12,22:  Print "You pressed ";
  498.  
  499.             Select Case RetCode%
  500.               Case is 1 to 10
  501.                 Print "function key F"; RetCode%;
  502.               Case -27
  503.                 Print "Esc.  I'm ending";
  504.               Case -13
  505.                 Print "Enter";
  506.             End Select
  507.          Loop
  508.                                                                          
  509.  
  510.         10                   Subroutine:         Mask
  511.                              ........................
  512.  
  513.          Mask is part of rsMinput's ".obj" module.  rsMinput calls Mask to
  514.          format text for "formatted data entry."  You can also CALL Mask
  515.          to format text for printing.
  516.  
  517.          Calling format
  518.          ..............
  519.  
  520.          CALL Mask (Text$, Msk$)
  521.  
  522.               Text$         The text to be formatted.
  523.  
  524.               Msk$          The mask to use for formatting.
  525.  
  526.               Notes:        - Text$ can be text or numbers (in string form).
  527.                             - To create a "mask," use "#" wherever you want
  528.                               Mask to insert a character from Text$.  Use
  529.                               other characters (or words) to "visually
  530.                               format" the field, or to prompt the user.
  531.                             - Mask converts "#" to more discrete dots.
  532.                             - BE SURE to read the section on RSET in
  533.                               P-Screen's manual.
  534.          Mask Example 1
  535.          ..............
  536.  
  537.          Text$ = "94117"
  538.          Msk$ = "Our Zip Code is:   ##### - ####"
  539.  
  540.          Call Mask (Text$, Msk$)
  541.          Locate 12, 30:  Print Text$
  542.  
  543.          '....this prints    Our Zip Code is:  94117 - ....
  544.  
  545.  
  546.                              Subroutine:    StripMask
  547.                              ........................
  548.  
  549.          StripMask (part of rsMinput.obj) strips the mask from a string,
  550.          and returns just the valid text.  rsMinput does this automatically.
  551.  
  552.          Calling format
  553.          ..............
  554.          Msk$ = "(###) ###-####"
  555.          Text$ = "4158630500"
  556.          Call Mask (Text$, Msk$)            'Text$ is now "(415) 863-0500"
  557.          CALL StripMask (Text$, Msk$)       'Text$ is now "4158630500"
  558.  
  559.               Notes:        - The mask you send to StripMask (Msk$) MUST
  560.                               be the same mask you used when calling Mask.
  561.                               If masks are different, StripMask won't be
  562.                               able to strip it properly.
  563.  
  564.                                                                              
  565.         11                   Subroutine:     StripTrail
  566.                              ..........................
  567.  
  568.          StripTrail (part of rsMinput.obj) strips any 1 character from
  569.          the end of a string.  Originally developed before Microsoft
  570.          added RTrim$ and LTrim$, it's still useful for stripping Chr$(0)'s
  571.          from Random record files.  And it's called by rsMinput to strip
  572.          the "prompt character" from Text$.  "Prompt character" is the
  573.          character you assigned with "RetCode% = #" (250, for example).
  574.  
  575.          Calling format
  576.          ..............
  577.          Call StripTrail (Text$, WhichChar$)
  578.  
  579.               Notes:        - Text$ is the string you want stripped.
  580.                               WhichChar$ is the character you want stripped.
  581.                             - StripTrail strips WhichChar$ only from the
  582.                               end of Text$.  It stops looking when it
  583.                               hits a character different than WhichChar$.
  584.  
  585.          StripTrail Example 1
  586.          ....................
  587.  
  588.          Call StripTrail (Text$, Chr$(0))         'strips Chr$(0) from
  589.                                                    records read from a
  590.                                                    Random file
  591.  
  592.  
  593.                                                                             
  594.         12                   Subroutine:       rsQprint
  595.                              ..........................
  596.  
  597.          rsQprint is an assembler routine to print text to the screen.
  598.          It's required by rsMinput and OneKey to display text.
  599.  
  600.          Calling format
  601.          ..............
  602.  
  603.          CALL rsQPrint(Row%, Column%, Colr%, Text$)
  604.  
  605.               Row%/        The screen row and column where you want text
  606.             Column%        printed.
  607.  
  608.               Colr%        The color.  Use the formula (or function
  609.                            "FNColr%") discussed under rsMinput to set Colr%.
  610.  
  611.               Text$         The text to be printed.  If (Column% + Len(Text$))
  612.                             exceed the number of columns on your screen,
  613.                             text will wrap to the beginning of the next line.
  614.  
  615.  
  616.                              Subroutine:     ProperName
  617.                              ..........................
  618.  
  619.  
  620.          ProperName is a QB function which returns a string properly
  621.          capitalized in "proper name" format -- the 1st letter of each
  622.          word capitalized.  Because it's a function, it MUST be declared
  623.          in QuickBASIC programs before it's called.
  624.  
  625.          Note:  In its current form, ProperName won't properly capitalize
  626.          names like MacDonald or McDonald (with 2 capital letters). If this
  627.          presents problems, let us know.  We can revise it -- though it
  628.          would grow in size.
  629.  
  630.          Calling format
  631.          ..............
  632.          Declare Function ProperName$ (Text$)      'required
  633.  
  634.          Text$ = ProperName$ (c$)                  'assign New variable
  635.          Print ProperName$ (Text$)                 'print in proper format
  636.  
  637.  
  638.          ProperName Example 1
  639.          ....................
  640.          Text$ = "san francisco"
  641.  
  642.          Print ProperName$ (Text$)                 '(prints "San Francisco")
  643.  
  644.  
  645.          ProperName Example 2
  646.          ....................
  647.          Input "Enter your name (all lower case): "; MyName$
  648.  
  649.          Print "Your name is "; ProperName$ (MyName$)
  650.                                                                               
  651.  
  652.          13                   Subroutine:    FormatUsing
  653.                               ..........................
  654.  
  655.          FormatUsing is a QB function that works just like BASIC's Print
  656.          Using statement.  But instead of printing something it returns a
  657.          "formatted" string.  You can edit the string, insert it into
  658.          another string, print it or save it.
  659.  
  660.          Because it's a function, it MUST be declared in QuickBASIC
  661.          programs before it's called.
  662.  
  663.  
  664.          Calling format
  665.          ..............
  666.          Declare Function FormatUsing$ (Format$, x#) 'required, note x# is
  667.                                                      'double precision
  668.  
  669.          Format$ = "$$#####,.##"                   'assign currency Format$
  670.          x# = 99
  671.          Text$ = FormatUsing$ (Format$, x#)        'Text$ is now "$   99.00"
  672.  
  673.  
  674.               Notes:        - Since FormatUsing$ works exactly like BASIC's
  675.                               Print Using, refer to a BASIC manual for
  676.                               details on including "#," "$," "," etc.
  677.                               P-Screen's manual has some of these details.
  678.                             - If Format$ is too short for the number,
  679.                               FormatUsing returns "%" as the 1st or 2nd
  680.                               digit (just like Print Using).
  681.                             - Format$ must not be longer than 24 charac-
  682.                               ters (just like Print Using).
  683.                             - In many cases, Text$ must be initialized
  684.                               with enough spaces to handle what's
  685.                               returned by FormatUsing.  If Text$ is too
  686.                               short, your number will be truncated.
  687.                             - Finally, RSET is often required to properly
  688.                               format certain numbers like phone numbers.
  689.  
  690.          FormatUsing Example 1
  691.          .....................
  692.          Format$ = "(###) ###-####"
  693.          x# = 4158630500
  694.          Text$= Space$(10)
  695.          RSET Text$ = FormatUsing$ (Format$, x#)   'Text$ is now:
  696.                                                    '"(415) 863-0500"
  697.  
  698.          FormatUsing Example 2
  699.          .....................
  700.          Format$ = "(###) ###-####"
  701.          x# = 8630500
  702.          Text$= Space$(10)
  703.          Text$ = FormatUsing$ (Format$, x#)        'Text$ is now:
  704.                                                    '"(863) 050-0..." ERROR
  705.  
  706.          This example shows how errors can occur if RSET is not used when
  707.          it should be.  Format$ has 10 digit positions (ie., 10 "#s").
  708.          But our number has only 7 digits.  If we had said: RSET Text$ =
  709.          FormatUsing$ (Format$, x#), Text$ would read (...) 863-0500.         
  710.  
  711.  
  712.          14                   Subroutine:         Exists
  713.                               ..........................
  714.  
  715.          Exists is a QB function to tell if a file exists before you try
  716.          to open it.  We use it in P-Screen's demo programs to see if a
  717.          screen library exists before we try to read help screens from it.
  718.  
  719.          Because it's a function, it MUST be declared in QuickBASIC
  720.          programs before it's called.
  721.  
  722.  
  723.          Calling format
  724.          ..............
  725.          Declare Function Exists (FileName$)       'required
  726.  
  727.          FileName$ = "P-SCREEN.PSL"                'NOTE:  Be certain
  728.                                                    'FileName$ contains NO
  729.                                                    'wild cards  (No * or ?)
  730.                                                    'See Notes for why.
  731.  
  732.          If NOT Exists (FileName$) then            'if not here, Exists = 0
  733.  
  734.             Print "Sorry, help screen library wasn't found"
  735.  
  736.          else                                      'Exists = -1, it exists
  737.  
  738.             Gosub DisplayHelp
  739.  
  740.          End If
  741.  
  742.  
  743.               Notes:        - Exists returns -1 if a file exists, and 0
  744.                               if it does not.
  745.  
  746.                             - If the File Name you sent down contains
  747.                               wild cards (* or ?), Exists exits immediately,
  748.                               and is set to 0 (doesn't exist.)  This pre-
  749.                               caution is to ensure you don't delete ALL
  750.                               files on a disk or directory (see next point).
  751.  
  752.                             - Exists simply checks the file length to
  753.                               determine if it exists.  If a file's
  754.                               length is 0 bytes, Exists DELETE'S the
  755.                               file and returns 0.  Zero-length files are
  756.                               very rare.  But if for some reason you use
  757.                               empty, zero-length files for some legitimate
  758.                               purpose, DON'T use Exists to check for THEIR
  759.                               existence.
  760.  
  761.