home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / database / p4w_all.zip / TI1244.ASC < prev    next >
Text File  |  1993-01-29  |  4KB  |  133 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.   PRODUCT  :  Paradox for Windows                   NUMBER  :  1244
  9.   VERSION  :  1.0
  10.        OS  :  WIN
  11.      DATE  :  January 29, 1993                         PAGE  :  1/2
  12.  
  13.     TITLE  :  Using ObjectPAL to fill edit lists on forms
  14.  
  15.  
  16.  
  17.  
  18.   Intended Audience:
  19.   This will be useful to any person beginning to use ObjectPAL on
  20.   forms.
  21.  
  22.   Prerequisites:
  23.   You need to know how to insert code into a method using the
  24.   Method Dialog Box while designing a form.
  25.  
  26.   Purpose:
  27.   To allow you to fill edit lists and drop-down edit lists from a
  28.   database.
  29.  
  30.   It is often desirable to have a picklist or drop-down edit field
  31.   available in your form when you are editing.  This allows the
  32.   programmer to constrain values entered into a field to those on
  33.   the list.  The user who needs ID numbers or some kind of items in
  34.   a list to be available does not wish to type in hundreds of ID's.
  35.   This can be solved with one line of code placed on the list
  36.   object of the drop-down edit box.
  37.  
  38.      self.DataSource = "[tablename.fieldname]"
  39.  
  40.      1.  If you use the file extension .db when describing your
  41.          tablename, you need to embed the tablename in quotes.
  42.          Since the expression is already in quotes, you need to use
  43.          \" in order to represent a quote (the backslash character
  44.          \ means take the next character literally).
  45.  
  46.          Example: self.DataSource = "[\"tablename.db\".fieldname]"
  47.  
  48.      2.  To reach the list object, select the field and open the
  49.          object tree using the speedbar.  Right click on the list
  50.          object listed on the object tree and place the code on the
  51.          open method.
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.   PRODUCT  :  Paradox for Windows                   NUMBER  :  1244
  75.   VERSION  :  1.0
  76.        OS  :  WIN
  77.      DATE  :  January 29, 1993                         PAGE  :  2/2
  78.  
  79.     TITLE  :  Using ObjectPAL to fill edit lists on forms
  80.  
  81.  
  82.  
  83.  
  84.      3.  This technique will change the actual value of the field
  85.          when you are in edit mode; it will not move to the record
  86.          that matches that value.  The list is a list of choices
  87.          that will change the VALUE of the current field that the
  88.          drop-down edit box is attached to.
  89.  
  90.   Using a dropdown-edit list to move to a new record (rather than
  91.   changing the value of the current record in that field) requires
  92.   a few extra steps.
  93.  
  94.      1.  First, make the drop-down an undefined field and name it
  95.          DROP.
  96.  
  97.      2.  Place the corresponding field on the form and turn off the
  98.          Runtime | Visible attribute so it will not be seen when
  99.          using the form.
  100.  
  101.      3.  Add the self.DataSource code the list object as before.
  102.  
  103.      4.  On the drop-down edit object (not the list object) change
  104.          two methods as follows:
  105.  
  106.          OPEN Method ::
  107.  
  108.               self.value = fieldname.value  ;this sets the
  109.                                             ;initial value
  110.  
  111.          NEWVALUE Method ::
  112.  
  113.               fieldName.locate("fieldname",DROP.value)
  114.  
  115.          Save and execute this.  The drop-down edit list now acts
  116.          as a data navigator of your table.  This is not
  117.          recommended for huge tables.
  118.  
  119.  
  120.   DISCLAIMER: You have the right to use this technical information
  121.   subject to the terms of the No-Nonsense License Statement that
  122.   you received with the Borland product to which this information
  123.   pertains.
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.