home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1993 #2
/
Image.iso
/
database
/
p4w_all.zip
/
TI1245.ASC
< prev
next >
Wrap
Text File
|
1993-01-29
|
3KB
|
133 lines
PRODUCT : Paradox for Windows NUMBER : 1245
VERSION : 1.0
OS : WIN
DATE : January 29, 1993 PAGE : 1/2
TITLE : Using Variables to Reference Objects on a Form
Intended Audience:
Anyone developing applications with ObjectPAL who has a basic
understanding of how to reference a Paradox For Windows form
object.
Purpose:
To enable you to reference objects without hard coding their
names in the application.
When working with several objects on a form, it is often
desirable to perform the same actions on each of the objects at
different points in your code. One technique that saves many
lines of code is to use a variable to reference an object.
There are three rules to remember when you use a variable to
reference an object.
1. The statement referencing an object must include a
containership path. In the example below, Page refers to
the actual page name where the object(Y) resides.
2. The first object in the path MUST not be a variable.
3. Surround the variable name with parentheses. For example:
for X from 1 to 10
Y = strVal(X)
Page.(Y).color = Blue
endFor
This will change the color of the objects named 1 through 10
to the color blue. Remember, it is easier to access the objects
if you rename them yourself.
PRODUCT : Paradox for Windows NUMBER : 1245
VERSION : 1.0
OS : WIN
DATE : January 29, 1993 PAGE : 2/2
TITLE : Using Variables to Reference Objects on a Form
If the object name is prefixed or suffixed by a number, i.e. 1Box
or Box1, you can use code that looks like the example shown below
(it assumes that you have ten objects named 1Box, up to 10Box):
for X from 1 to 10
Y = strVal(X) + "Box" ; this evaluates Y = "1Box" for
Page.(Y).color = Blue ; the first iteration of the
; for loop
endFor
This technique enables you to have more descriptive object names.
For more information, refer to the ObjectPAL Developer's Guide,
Chapter 5, under the heading "Variables".
DISCLAIMER: You have the right to use this technical information
subject to the terms of the No-Nonsense License Statement that
you received with the Borland product to which this information
pertains.