home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 99.img / PDOX3-08.ZIP / TOOLKIT1 / HELPDEMO.SC < prev    next >
Text File  |  1989-09-15  |  14KB  |  314 lines

  1. ; Copyright (c) 1988, 1989 Borland International.  All Rights Reserved.
  2. ;
  3. ; General permission to re-distribute all or part of this script is granted,
  4. ; provided that this statement, including the above copyright notice, is not
  5. ; removed.  You may add your own copyright notice to secure copyright
  6. ; protection for new matter that you add to this script, but Borland
  7. ; International will not support, nor assume any legal responsibility for,
  8. ; material added or changes made to this script.
  9. ;
  10. ; Revs.: RFG 12/16/88, DCY 12/18/88
  11. ; ****************************************************************************
  12. ;  NAME: ToggleCommentary
  13. ; EVENT: N/A
  14. ; NOTES: ToggleCommentary toggles the state of commentary mode.
  15. ; ****************************************************************************
  16. Proc ToggleCommentary()
  17.  
  18.    If Commentary                  ;Is commentary already on?
  19.       Then Commentary = False     ;  Yes-turn it off
  20.            TKMessage = "Commentary is now turned off"
  21.       Else Commentary = True      ;  No-turn it on
  22.            TKMessage = "Commentary is now turned on"
  23.    Endif
  24.    TKAccept = False ;Don't want Paradox to act upon [Alt][C] key (beep)
  25.  
  26. Endproc
  27. Writelib DemoLib ToggleCommentary
  28. Release Procs ToggleCommentary
  29.  
  30. ; ****************************************************************************
  31. ;  NAME: InactivityProc
  32. ; EVENT: Keyboard Inactivity
  33. ; FIELD: N/A
  34. ; TABLE: Invoice, Cust, Orders
  35. ; NOTES: InactivityProc is assigned as the keyboard inactivity procedure for
  36. ;        the Invoice, Cust, and Orders tables.  If commentary mode is on,
  37. ;        InactivityProc will display a help box after 2 seconds of keyboard
  38. ;        inactivity.  Because we're using one inactivity procedure for all
  39. ;        three tables we need to first check the current image as well as the
  40. ;        current field.
  41. ; ****************************************************************************
  42. Proc InactivityProc()
  43.  
  44.    ;Only show help box for a field if commentary mode is on and if three
  45.    ; or more seconds has elapsed since a keypress.  Note that since we're
  46.    ; requiring TKSeconds < 4 to display a help box, we'll only display a
  47.    ; help box once until a user presses a key.
  48.    If Commentary and TKSeconds < 4 and Mod(TKSeconds,3) = 0
  49.       Then Echo Off
  50.            Style Attribute SysColor(9)
  51.            Switch
  52.               Case ImageNo() = 1 :   ;Cust table
  53.                  Switch  ;TKFieldNum is the column number of the current field
  54.                     Case not NewCust:
  55.                        ViewCustBox()      ;Display-only Cust record
  56.                     Case TKFieldNum = 7 :  
  57.                        CustStateBox()    ;State field
  58.                     Case TKFieldNum = 9 :
  59.                        CustPhoneBox()    ;Phone field
  60.                     Otherwise :
  61.                        EditCustBox()      ;Modifiable Cust record
  62.                  Endswitch
  63.               Case ImageNo() = 2 :   ;Invoice table
  64.                  Switch
  65.                     Case TKFieldNum = 4 :
  66.                        CustNoBox()       ;Customer No.
  67.                     Case TKFieldNum = 7 :
  68.                        MethPaymntBox()   ;Method of Payment
  69.                     Case TKFieldNum = 8 :
  70.                        CardNumHelp()     ;Credit card number
  71.                     Case TKFieldNum = 9 :
  72.                        ExpirDateBox()    ;Expiration date
  73.                     Case TKFieldNum = 10 :
  74.                        ShipViaBox()      ;Ship Via
  75.                  Endswitch
  76.               Otherwise :            ;Orders table
  77.                  OrdersBox()
  78.            Endswitch
  79.            SetMargin Off
  80.            SyncCursor
  81.            Style
  82.    Endif
  83.  
  84. Endproc
  85. Writelib DemoLib InactivityProc
  86. Release Procs InactivityProc
  87.  
  88. ; ****************************************************************************
  89. ; The remaining procedures simply display commentary text when activated.
  90. ; ****************************************************************************
  91.  
  92. Proc CustStateBox()
  93.  
  94.    @ 14, 4
  95.    SetMargin 4
  96.    Text
  97. ╔═══════════════════════════════════════════════════════════════════════╗
  98. ║  A Paradox picture validity check forces the State code to two        ║
  99. ║  upper-case letters.  A lookup table could be used to test for valid  ║
  100. ║  input, although that has not been done here.                         ║
  101. ║                                                                       ║
  102. ║  If you enter "CA" as the state code, 7.5% tax will be added to the   ║
  103. ║  order; otherwise, no tax will be added.                              ║
  104. ║  ───────────────────────────────────────────────────────────────────  ║
  105. ║  Enter a state code.  You will automatically move to the next field.  ║
  106. ╚═══════════════════════════════════════════════════════════════════════╝
  107.    Endtext
  108.  
  109. Endproc
  110. Writelib DemoLib CustStateBox
  111. Release Procs CustStateBox
  112.  
  113. Proc CustPhoneBox()
  114.  
  115.    @ 14, 4
  116.    SetMargin 4
  117.    Text
  118. ╔═══════════════════════════════════════════════════════════════════════╗
  119. ║  You may enter a Telephone number with or without an area code.  If   ║
  120. ║  you supply an area code, our FillPhone "keystroke" procedure moves   ║
  121. ║  you out of the field as soon as you enter a complete number.  If you ║
  122. ║  don't supply an area code, when you leave the field DoWait activates ║
  123. ║  our NormalizePhone procedure, which enters a default value of "415". ║
  124. ║  In either case, our NormalizePhone procedure will automatically      ║
  125. ║  format the phone number with parentheses and a hyphen if necessary.  ║
  126. ║  ───────────────────────────────────────────────────────────────────  ║
  127. ║  Enter a telephone number, with or without an area code.              ║
  128. ╚═══════════════════════════════════════════════════════════════════════╝
  129.    Endtext
  130.  
  131. Endproc
  132. Writelib DemoLib CustPhoneBox
  133. Release Procs CustPhoneBox
  134.  
  135. Proc EditCustBox()
  136.  
  137.    @ 14, 4
  138.    SetMargin 4
  139.    Text
  140. ╔═══════════════════════════════════════════════════════════════════════╗
  141. ║  When you arrive in the Cust table, DoWait calls our SetCustPrompt    ║
  142. ║  procedure, which displays the top-level prompt you see now.          ║
  143. ║                                                                       ║
  144. ║  When you try to move to another customer record or press [F2],       ║
  145. ║  DoWait activates EditCustRec.  EditCustRec requires you to enter     ║
  146. ║  data in every field, then allows you to return to the Invoice table. ║
  147. ║  ───────────────────────────────────────────────────────────────────  ║
  148. ║  Enter information for a new customer.  Press [F2] to add them into   ║
  149. ║  Cust or [Esc] to discard this input and return to the Invoice table. ║
  150. ╚═══════════════════════════════════════════════════════════════════════╝
  151.    Endtext
  152.  
  153. Endproc
  154. Writelib DemoLib EditCustBox
  155. Release Procs EditCustBox
  156.  
  157. Proc ViewCustBox()
  158.  
  159.    @ 15, 4
  160.    SetMargin 4
  161.    Text
  162. ╔═══════════════════════════════════════════════════════════════════════╗
  163. ║  We've instructed DoWait to call our SetCustPrompt procedure when you ║
  164. ║  arrive in the Cust table.  Because you selected an existing customer ║
  165. ║  number for this invoice, SetCustPrompt made the Cust table a         ║
  166. ║  display-only type of image.                                          ║
  167. ║  ───────────────────────────────────────────────────────────────────  ║
  168. ║  Use the cursor movement keys to examine customer data.  Press [F3]   ║
  169. ║  or [F4] to return to the Invoice table.                              ║
  170. ╚═══════════════════════════════════════════════════════════════════════╝
  171.    Endtext
  172.  
  173. Endproc
  174. Writelib DemoLib ViewCustBox
  175. Release Procs ViewCustBox
  176.  
  177. Proc CustNoBox()
  178.  
  179.    @ 8, 4
  180.    SetMargin 4
  181.    Text
  182. ╔═══════════════════════════════════════════════════════════════════════╗
  183. ║  DoWait invokes procedures when a user performs an action such as     ║
  184. ║  leaving a field, moving to a new record, or pressing a designated    ║
  185. ║  special key.  An application developer writes these procedures and   ║
  186. ║  specifies the events or actions which trigger them.                  ║
  187. ║                                                                       ║
  188. ║  For example, we've instructed DoWait to call our GetCustNo procedure ║
  189. ║  when you attempt to leave the Customer No. field.  GetCustNo:        ║
  190. ║  - fills in corresponding data if you enter an existing Customer No.  ║
  191. ║  - prompts you to enter customer information if you enter a new       ║
  192. ║    Customer No.                                                       ║
  193. ║  - presents a customized message if you try to leave the field blank  ║
  194. ║  ───────────────────────────────────────────────────────────────────  ║
  195. ║  Press [F1] to select a person from the current customer list, or     ║
  196. ║  enter a new Customer No. to add a name to the master customer list.  ║
  197. ╚═══════════════════════════════════════════════════════════════════════╝
  198.    EndText
  199.  
  200. Endproc
  201. Writelib DemoLib CustNoBox
  202. Release Procs CustNoBox
  203.  
  204. Proc MethPaymntBox()
  205.  
  206.    @ 3, 15
  207.    SetMargin 20
  208.    Text
  209. ╔═════════════════════════════════════════════════════╗
  210. ║  Here we've used the Toolkit's Popup procedure to   ║
  211. ║  present you with a list of payment options.        ║
  212. ║  When you attempt to leave the field, our ValidPay  ║
  213. ║  procedure checks the option you select and takes   ║
  214. ║  you to the fields for credit card information only ║
  215. ║  if you've selected a credit card.                  ║
  216. ║                                                     ║
  217. ║  To further demonstrate how the Toolkit can control ║
  218. ║  the data entry process, we've specified that you   ║
  219. ║  must enter a value in this field.                  ║
  220. ║  ─────────────────────────────────────────────────  ║
  221. ║  Press [F1] and select a method of payment.         ║
  222. ╚═════════════════════════════════════════════════════╝
  223.    Endtext
  224.  
  225. Endproc
  226. Writelib DemoLib MethPaymntBox
  227. Release Procs MethPaymntBox
  228.  
  229. Proc CardNumHelp()
  230.   TKMessage = "Enter any number and press Enter.  Press Del to cancel"
  231. Endproc
  232.  
  233. Writelib DemoLib CardNumHelp
  234. Release Procs CardNumHelp
  235.  
  236. Proc ExpirDateBox()
  237.  
  238.    @ 2, 20
  239.    SetMargin 20
  240.    Text
  241. ╔═══════════════════════════════════════════════════════╗
  242. ║  Paradox's built-in date validation ensures that      ║
  243. ║  you enter a valid value in the Expiration Date       ║
  244. ║  field.  In addition, DoWait passes every character   ║
  245. ║  you type here to a customized "keystroke"            ║
  246. ║  procedure called LeaveFullDate.                      ║
  247. ║                                                       ║
  248. ║  When you've entered a 2-digit year, LeaveFullDate:   ║
  249. ║      - gives you a warning if the credit card has     ║
  250. ║        expired                                        ║
  251. ║      - moves you directly to the order section on     ║
  252. ║        the second page of this form if the date is    ║
  253. ║        valid (today or in the future).  Notice you do ║
  254. ║        not need to press Enter to leave this field.   ║
  255. ║  ───────────────────────────────────────────────────  ║
  256. ║  Enter a date in any Paradox date format.             ║
  257. ╚═══════════════════════════════════════════════════════╝
  258.    Endtext
  259.  
  260. Endproc
  261. Writelib DemoLib ExpirDateBox
  262. Release Procs ExpirDateBox
  263.  
  264. Proc ShipViaBox()
  265.  
  266.    @ 0, 4
  267.    SetMargin 4
  268.    Text
  269. ╔═══════════════════════════════════════════════════════════════════════╗
  270. ║  When you move out of the Ship Via field, DoWait activates our field  ║
  271. ║  "depart" procedure which checks for invalid carrier services and     ║
  272. ║  also updates the Total field.  You may exit the field while it is    ║
  273. ║  empty, but you must enter a value before posting an invoice record.  ║
  274. ║                                                                       ║
  275. ║  Press this key:           In Ship Via to:                            ║
  276. ║      PgUp              Return to the first page of invoice data       ║
  277. ║      Up or Left        Move to the order records for this invoice     ║
  278. ║      Enter or Tab      Confirm this record is complete and post it    ║
  279. ║  ───────────────────────────────────────────────────────────────────  ║
  280. ║  Press [F1] to select a carrier from the table below.  When you have  ║
  281. ║  completed this invoice record, press Enter to post it.               ║
  282. ╚═══════════════════════════════════════════════════════════════════════╝
  283.    Endtext
  284.  
  285. Endproc
  286. Writelib DemoLib ShipViaBox
  287. Release Procs ShipViaBox
  288.  
  289. Proc OrdersBox()
  290.  
  291.    @ 10, 4
  292.    SetMargin 4
  293.    Text
  294. ╔═══════════════════════════════════════════════════════════════════════╗
  295. ║  Use [Enter], [Left] and [Right] to move among records in the Orders  ║
  296. ║  table.  To complete a record, you'll need to enter values into       ║
  297. ║  both the Item and Qty. fields.  Press [F2] or [Down] to move out of  ║
  298. ║  the Orders table and into the Ship Via field of the Invoice table.   ║
  299. ║                                                                       ║
  300. ║  When you have completed a record and attempt to leave it, DoWait     ║
  301. ║  activates our "record depart" procedure.  As you edit order records, ║
  302. ║  we use this procedure along with a "record arrival" procedure to:    ║ 
  303. ║      - maintain record sequence as you insert and delete order data   ║
  304. ║      - update the Amount fields and the invoice totals                ║
  305. ║  ───────────────────────────────────────────────────────────────────  ║
  306. ║  Enter an Item number (using [F1] to get a list of valid numbers) and ║
  307. ║  a quantity.  Press [Down] when done entering order information.      ║
  308. ╚═══════════════════════════════════════════════════════════════════════╝
  309.    Endtext
  310.  
  311. Endproc
  312. Writelib DemoLib OrdersBox
  313. Release Procs OrdersBox
  314.