home *** CD-ROM | disk | FTP | other *** search
/ Shareware 1 2 the Maxx / sw_1.zip / sw_1 / TEXT / PDX_ALL.ZIP / TI131.ASC < prev    next >
Text File  |  1991-12-04  |  8KB  |  265 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.   PRODUCT  :  Paradox                                NUMBER  :  131
  9.   VERSION  :  All
  10.        OS  :  DOS
  11.      DATE  :  December 4, 1991                         PAGE  :  1/4
  12.  
  13.     TITLE  :  Preventing Users From Accidentally Deleting Records
  14.  
  15.  
  16.  
  17.  
  18.   Paradox allows users to easily delete records from a table.  Some
  19.   users, though, may prefer to have Paradox verify that a specific
  20.   record should be deleted.  This can be quickly accomplished with
  21.   a small PAL script and an adjustment to the way Paradox handles
  22.   the <Delete> key.
  23.  
  24.   While this verification process is easy to add, it can seem
  25.   difficult to those with a limited exposure to Paradox.  Before
  26.   attempting the techniques discussed here, please make sure you
  27.   are familiar with the following concepts:
  28.  
  29.     --  DOS directories.  Users should be comfortable with the
  30.         concept of DOS directories and know how to use the Tools |
  31.         More | Directory command to change directories in Paradox.
  32.         An introduction to DOS directories is offered in Appendix A
  33.         of the Paradox 3.5 Introduction guide while Tools | More |
  34.         Directory is covered in Chapter 10 of the Paradox User's
  35.         Guide.  More information about DOS and directories can be
  36.         found in any MS-DOS User's Manual.
  37.  
  38.     --  PAL scripts.  Users should know what a PAL script is and
  39.         how to write and edit one.  See the first few chapters of
  40.         the PAL User's Guide for information about creating and
  41.         using scripts.  It would also be useful to know how PAL
  42.         works with variables, though this is not required.
  43.  
  44.     --  Network users should also be familiar with Paradox's use of
  45.         private directories and the INIT script.  Private
  46.         directories are covered in Chapter 2 of the Network
  47.         Administrator's Guide and the INIT script is discussed in
  48.         Chapter 7 of the PAL User's Guide.
  49.  
  50.   Once the verification process is set up, it is simple to use.
  51.   The only person who needs a basic understanding of the above
  52.   concepts is the one implementing it.
  53.  
  54.   Installing the process requires two steps.  First, you will need
  55.   a PAL script that makes certain the record should be deleted by
  56.   allowing the user to verify the deletion or cancel the operation.
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.   PRODUCT  :  Paradox                                NUMBER  :  131
  75.   VERSION  :  All
  76.        OS  :  DOS
  77.      DATE  :  December 4, 1991                         PAGE  :  2/4
  78.  
  79.     TITLE  :  Preventing Users From Accidentally Deleting Records
  80.  
  81.  
  82.  
  83.  
  84.   The following script shows one example of how this can be
  85.   accomplished.
  86.  
  87.        CMode = Sysmode()
  88.        If (not (IsFieldView())) and (CMode = "Edit" or
  89.           CMode = "CoEdit" or CMode = "DataEntry") Then
  90.           Showmenu
  91.              "Cancel" : "Oops, do NOT remove this record.",
  92.              "Ok" : "Yes, PERMANENTLY delete this record."
  93.           Default "Cancel" to DelRec
  94.           If (Retval) and (DelRec = "Ok") Then
  95.              Del
  96.           Endif
  97.        Else
  98.           Del
  99.        Endif
  100.        Release Vars CMode, DelRec
  101.  
  102.   To actually delete a record with this script while Paradox is in
  103.   an appropriate mode, the user must press <Delete> and then select
  104.   Ok from the menu that appears.  If the user presses <Delete>
  105.   accidentally,  selecting Cancel or pressing <Esc> returns the
  106.   user to the table without deleting the current record.
  107.  
  108.   To create this script, use the following process:
  109.  
  110.     --  First, load Paradox and change to the directory where
  111.         Paradox is installed with the Tools | More | Directory
  112.         command.  The default directory for Paradox 3.5 is
  113.         C:\PDOX35.
  114.  
  115.     --  Next, select Scripts | Editor | Write.  When the "Name:"
  116.         prompt appears, type DELREC and press <Enter>.
  117.  
  118.     --  When the Script Editor screen appears, type in the script
  119.         exactly as it appears above.
  120.  
  121.     --  After you have typed the script into the Script Editor,
  122.         press <F2>.  Your DELREC script will be saved.
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.   PRODUCT  :  Paradox                                NUMBER  :  131
  141.   VERSION  :  All
  142.        OS  :  DOS
  143.      DATE  :  December 4, 1991                         PAGE  :  3/4
  144.  
  145.     TITLE  :  Preventing Users From Accidentally Deleting Records
  146.  
  147.  
  148.  
  149.  
  150.   The second part of this process actually "adds" the feature to
  151.   Paradox and can take one of two forms.  Perhaps the quickest way
  152.   to do this is to press <Alt-F10>, select Miniscript, type:
  153.  
  154.             SETKEY -83 PLAY "C:\\PDOX35\\DELREC"
  155.  
  156.   and then press <Enter>.  This tells Paradox to play the DELREC
  157.   script every time the <Delete> key is pressed.
  158.  
  159.   If your copy of Paradox is located in a different directory, be
  160.   sure to change the C:\\PDOX35\\ part of the SETKEY command to
  161.   reflect the actual directory where Paradox is installed.  (Make
  162.   certain you use two "back-slashes" (\\) to separate the various
  163.   branches of the directory name.)
  164.  
  165.   The Miniscript approach is a good way to test your new script,
  166.   for it immediately changes the behavior of the <Delete> key.
  167.   There is a drawback, though.  The new definition only stays in
  168.   effect until you exit Paradox.
  169.  
  170.   To have this feature "permanently" added to your installed copy
  171.   of Paradox, include the above line to your INIT script located in
  172.   the directory where Paradox is installed.  The INIT script is
  173.   analogous to the DOS AUTOEXEC.BAT file; that is, Paradox
  174.   automatically looks for (and executes) the INIT script every time
  175.   the program starts.  Network users will need to have an INIT
  176.   script located in their private directories; that is, the
  177.   directory where their personalized PARADOX.CFG file is located.
  178.  
  179.   To change an existing INIT script, select Scripts | Editor | Edit
  180.   from the main Paradox menu.  If you get an error message similar
  181.   to "Cannot find INIT script", you may not have an INIT script and
  182.   should use Scripts | Editor | Write to create one.  Be sure to
  183.   change to the proper directory before creating the INIT script.
  184.  
  185.   There are other ways to design the DELREC script.  The one given
  186.   earlier is not the only way to approach the process, although it
  187.   does follow good programming rules.  It makes certain the user is
  188.   in a mode where records can be deleted, allows the user to press
  189.   the <Esc> key during the menu and "cleans up after itself" by
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.   PRODUCT  :  Paradox                                NUMBER  :  131
  207.   VERSION  :  All
  208.        OS  :  DOS
  209.      DATE  :  December 4, 1991                         PAGE  :  4/4
  210.  
  211.     TITLE  :  Preventing Users From Accidentally Deleting Records
  212.  
  213.  
  214.  
  215.  
  216.   clearing the variables it defines.  An alternate approach for
  217.   DELREC might be:
  218.  
  219.        @ 0,0 "Delete this record? (Y/N):  "
  220.        Accept "A1" Picture "{Y,N}" Default "N" Required To DelRec
  221.        If DelRec = "Y" Then
  222.           Del
  223.        Endif
  224.  
  225.   This example is not as detailed as the earlier one, but it can be
  226.   just as effective.  It also does less error checking, potentially
  227.   making life more difficult for the average user.  Still, with a
  228.   little work, it could be as useful as the first example script.
  229.  
  230.   If this second approach is used for DELREC, the user will have to
  231.   press the <Delete> key, hit <Backspace> to delete the default "N"
  232.   value which appears in the upper left corner of the screen, type
  233.   Y and finally press <Enter> before the record will be erased.
  234.  
  235.   As you can see, PAL allows you to approach a specific problem
  236.   from different directions.  The PAL User's Guide describes the
  237.   syntax and use of each command (in Chapter 20) and function
  238.   (Chapter 21) used in the two example scripts.  It is a good
  239.   resource for any questions you might have along these lines.
  240.   Feel free to experiment with different variations of these
  241.   examples (or to create your own approach).  Make certain, though,
  242.   to make backups of any data files you experiment with.
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.