home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1993 #2
/
Image.iso
/
database
/
p4w_all.zip
/
TI1244.ASC
< prev
next >
Wrap
Text File
|
1993-01-29
|
4KB
|
133 lines
PRODUCT : Paradox for Windows NUMBER : 1244
VERSION : 1.0
OS : WIN
DATE : January 29, 1993 PAGE : 1/2
TITLE : Using ObjectPAL to fill edit lists on forms
Intended Audience:
This will be useful to any person beginning to use ObjectPAL on
forms.
Prerequisites:
You need to know how to insert code into a method using the
Method Dialog Box while designing a form.
Purpose:
To allow you to fill edit lists and drop-down edit lists from a
database.
It is often desirable to have a picklist or drop-down edit field
available in your form when you are editing. This allows the
programmer to constrain values entered into a field to those on
the list. The user who needs ID numbers or some kind of items in
a list to be available does not wish to type in hundreds of ID's.
This can be solved with one line of code placed on the list
object of the drop-down edit box.
self.DataSource = "[tablename.fieldname]"
1. If you use the file extension .db when describing your
tablename, you need to embed the tablename in quotes.
Since the expression is already in quotes, you need to use
\" in order to represent a quote (the backslash character
\ means take the next character literally).
Example: self.DataSource = "[\"tablename.db\".fieldname]"
2. To reach the list object, select the field and open the
object tree using the speedbar. Right click on the list
object listed on the object tree and place the code on the
open method.
PRODUCT : Paradox for Windows NUMBER : 1244
VERSION : 1.0
OS : WIN
DATE : January 29, 1993 PAGE : 2/2
TITLE : Using ObjectPAL to fill edit lists on forms
3. This technique will change the actual value of the field
when you are in edit mode; it will not move to the record
that matches that value. The list is a list of choices
that will change the VALUE of the current field that the
drop-down edit box is attached to.
Using a dropdown-edit list to move to a new record (rather than
changing the value of the current record in that field) requires
a few extra steps.
1. First, make the drop-down an undefined field and name it
DROP.
2. Place the corresponding field on the form and turn off the
Runtime | Visible attribute so it will not be seen when
using the form.
3. Add the self.DataSource code the list object as before.
4. On the drop-down edit object (not the list object) change
two methods as follows:
OPEN Method ::
self.value = fieldname.value ;this sets the
;initial value
NEWVALUE Method ::
fieldName.locate("fieldname",DROP.value)
Save and execute this. The drop-down edit list now acts
as a data navigator of your table. This is not
recommended for huge tables.
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.