BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Subclass Editing field of superclass

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OO design
View previous topic :: View next topic  
Author Message
Webmaster StartmetDelphi
Guest





PostPosted: Sat Nov 15, 2003 3:42 pm    Post subject: Subclass Editing field of superclass Reply with quote



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.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OO design All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.