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

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.   PRODUCT  :  Paradox for Windows                   NUMBER  :  1245
  9.   VERSION  :  1.0
  10.        OS  :  WIN
  11.      DATE  :  January 29, 1993                         PAGE  :  1/2
  12.  
  13.     TITLE  :  Using Variables to Reference Objects on a Form
  14.  
  15.  
  16.  
  17.  
  18.   Intended Audience:
  19.   Anyone developing applications with ObjectPAL who has a basic
  20.   understanding of how to reference a Paradox For Windows form
  21.   object.
  22.  
  23.   Purpose:
  24.   To enable you to reference objects without hard coding their
  25.   names in the application.
  26.  
  27.  
  28.   When working with several objects on a form, it is often
  29.   desirable to perform the same actions on each of the objects at
  30.   different points in your code.  One technique that saves many
  31.   lines of code is to use a variable to reference an object.
  32.  
  33.   There are three rules to remember when you use a variable to
  34.   reference an object.
  35.  
  36.      1.  The statement referencing an object must include a
  37.          containership path.  In the example below, Page refers to
  38.          the actual page name where the object(Y) resides.
  39.  
  40.      2.  The first object in the path MUST not be a variable.
  41.  
  42.      3.  Surround the variable name with parentheses.  For example:
  43.  
  44.          for X from 1 to 10
  45.              Y = strVal(X)
  46.              Page.(Y).color = Blue
  47.          endFor
  48.  
  49.   This will change the color of the objects named 1 through 10
  50.   to the color blue.  Remember, it is easier to access the objects
  51.   if you rename them yourself.
  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  :  1245
  75.   VERSION  :  1.0
  76.        OS  :  WIN
  77.      DATE  :  January 29, 1993                         PAGE  :  2/2
  78.  
  79.     TITLE  :  Using Variables to Reference Objects on a Form
  80.  
  81.  
  82.  
  83.  
  84.   If the object name is prefixed or suffixed by a number, i.e. 1Box
  85.   or Box1, you can use code that looks like the example shown below
  86.   (it assumes that you have ten objects named 1Box, up to 10Box):
  87.  
  88.       for X from 1 to 10
  89.           Y = strVal(X) + "Box"    ; this evaluates Y = "1Box" for
  90.           Page.(Y).color = Blue    ;   the first iteration of the
  91.                                    ;   for loop
  92.       endFor
  93.  
  94.   This technique enables you to have more descriptive object names.
  95.  
  96.   For more information, refer to the ObjectPAL Developer's Guide,
  97.   Chapter 5, under the heading "Variables".
  98.  
  99.  
  100.   DISCLAIMER: You have the right to use this technical information
  101.   subject to the terms of the No-Nonsense License Statement that
  102.   you received with the Borland product to which this information
  103.   pertains.
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.