Webmaster StartmetDelphi Guest
|
Posted: Sat Nov 15, 2003 3:42 pm Post subject: Subclass Editing field of superclass |
|
|
Hi guys and girls,
I have a class, named 'Point' and a subclass of point named 'Circle'.
The point contains and x-value and an y-value.
The circle inherits the values from the point, and has its own
attribute called 'Radius'.
That's the design part. Sounds familiar...
To store this kind of information, I have to (Paradox-)tables. The
first one called PointTable, with an ID, an X-value and a Y-value.
The second table is called CircleTable and contains a PointID and a
radius.
Thats the database part of the story.
In Delphi, I have two TTables, one for each table.
For the CircleTable, I have created two calculated fields: XValue and
YValue.
The OnCalcFields event of CircleTable, I first look for the
corresponding PointTable with
PointTable.FindKey(CircleTable.FieldByName('PointId').Value]) ;
and fill the values for the calculated fields XValue and YValue.
This works fine for displaying records for the CircleTable: It shows
she XValue and YValue as if they are stored in the CircleTable.
Here comes my problem:
How can I edit the XValue and YValue in EditFields?
I could surely point the DataSet property of the EditFields to
PointTable in stead of the CircleTable, but then my whole design
fails, as for using CircleTable, I don't want to know which fields
belong to a superclass PointTable. It should be something strictly
encapsulated in the events of CircleTable.
This is of course a simplified example of my real problem, where
finding back the original superclass containing the field is much
trickier.
Any help is welcome!
John.
|
|