home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a114 / 2.img / TOOLKIT / TOOLKIT.ZIP / MINIDEMO.SC < prev    next >
Encoding:
Text File  |  1990-08-25  |  4.3 KB  |  99 lines

  1. ; ****************************************************************************
  2. ; This mini-demonstration lets you add customer information into the Cust
  3. ; table under the supervision of DoWait.  Before attempting to play this
  4. ; script make sure you've followed the directions (listed under "Using DoWait"
  5. ; in the Data Entry Toolkit chapter of the PAL User's Guide) for making the
  6. ; DoWait Procedure Assignment (DPA) script MINIPROC.SC.  We've actually made
  7. ; and included a copy of it for you--it's named MINIDPA.SC.
  8. ; ****************************************************************************
  9.  
  10. ; EditCustInfo is the main procedure of this mini-demonstration.  It loads
  11. ; and executes the Toolkit procedures required to run the demo.
  12. ;
  13. Proc EditCustInfo()
  14.  
  15.    ;Read Toolkit procedures necessary for this mini-demonstration
  16.    Readlib SDir()+"Toolkit" InitWait,     ;Loads DoWait
  17.                             SetKeycodes,  ;Defines mnemonic keycodes
  18.                             EditMenu      ;Presents a simple edit menu
  19.  
  20.    SetKeycodes()      ;SetKeycodes defines variables which make it easier for
  21.                       ; us to remember ASCII and IBM Extended keycode values
  22.                       ; (we'll be using a couple of them below).
  23.    InitWait(1,"1","Cust")  ;InitWait loads DoWait and its supplementary
  24.                            ; procedures.  This particular set of arguments
  25.                            ; instructs DoWait that:
  26.                            ; a. the highest image number of a table we'll be
  27.                            ;    using with DoWait is 1 (the first argument).
  28.                            ; b. the image number of the table we'll be using
  29.                            ;    (Cust) is "1" (the second argument).
  30.                            ; c. the table linked to the image number (second
  31.                            ;    argument) is "Cust" (the third argument).
  32.  
  33.    Release Procs InitWait,   ;Release procs we no longer need
  34.                  SetKeycodes
  35.  
  36.    Play "MiniProc"     ;Define DoWait procedure assignments and key classes
  37.                        ;  (defined in the DPA procedure saved in MiniProc by
  38.                        ;   SetUpDoWait).
  39. ;  Play "MiniDPA"      ;MiniDPA is a copy of MiniProc we've already made for
  40.                        ; you.
  41.  
  42.    Edit "Cust"         ;View Cust, the table we'll be using with DoWait
  43.    End
  44.    Down                ;Open up a new record
  45.    PickForm "1"        ;View the customer information form
  46.  
  47.                        ;Customize prompt lines
  48.    Prompt "Entering customer information.",
  49.           "Press [F2] to add customer to master list or [F10]/Cancel to cancel."
  50.  
  51.    DoWait("Welcome to DoWait")  ;Invoke DoWait, displaying an entry message
  52.  
  53.    Prompt              ;Restore the Paradox system prompt line
  54.  
  55.    If Retval = TKDo_It!   ;If user pressed Do-It! to exit DoWait, save
  56.       Then Do_It!         ; changes.  Otherwise, cancel all changes.
  57.       Else CancelEdit
  58.    Endif
  59.  
  60. Endproc
  61.  
  62. ; DoWait calls LeaveName when a user presses a "regular" key within the
  63. ; Last Name and First Name fields of the Cust table.  LeaveName will
  64. ; automatically move the cursor to the next field if a user presses the
  65. ; spacebar in either of these fields.
  66. ;
  67. Proc LeaveName()
  68.  
  69.  
  70.    If TKChar = TKSpaceBar      ;Was the pending key (TKChar) the spacebar?
  71.       Then TKChar = TKRight    ;If so, change its value, making Paradox
  72.    Endif                       ; act upon right arrow (TKRight) instead.
  73.  
  74.   ;TKSpaceBar and TKRight are variables defined by the Toolkit's SetKeycodes
  75.   ; procedure above.
  76.  
  77. Endproc
  78.  
  79. ; DoWait calls SetDiscount when a user leaves the Zip Code field of
  80. ; the Cust table.  If the Zip Code is greater than 90000 (the
  81. ; customer is on the west coast), then SetDiscount automatically enters
  82. ; a value of 15 into the Discount % field.  SetDiscount is an example of a
  83. ; field departure procedure--one called by DoWait when a user moves out
  84. ; of a field.
  85.  
  86. Proc SetDiscount()
  87.    If IsBlank([Discount %])                     ;Only fill Discount % if not
  88.       Then If [] > "90000"                      ; already given a value.
  89.               Then [Discount %] = 15
  90.               Else [Discount %] =  0
  91.            Endif
  92.    Endif
  93.  
  94. Endproc
  95.  
  96. Reset              ;Clear the workspace
  97. EditCustInfo()     ;Initialize editing session
  98. Release Vars All   ;Release variables
  99.