Solved

Access to the property of ancestor class

Posted on 2001-09-13
1
194 Views
Last Modified: 2013-11-23
hi

Can I get access to the property of ancestor class taking into account that this property was redefined in the descendant class:

MyClass = class(TLabel)
.....
property Left read ... write ...
end;


I need to write GetLeft and SetLeft procedures to read/write Left property of ancestor class and peform some additional actions.

Probably, it can be resolved using another method, without redefining Left property. The purpose is to peform some actions when Left property is changed.

Vasily.
0
Comment
Question by:vterekh
1 Comment
 
LVL 17

Accepted Solution

by:
geobul earned 30 total points
ID: 6479521
Hi,
As you already have FLeft field and Left property defined in the TControl, you just need to override
SetLeft procedure:

 private
  procedure SetLeft(Value: Integer);
 public
  constructor Create(AOwner: TComponent); override;
 published
  property Left write SetLeft;
 end;

constructor TMyClass.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
end;

procedure TMyClass.SetLeft(Value: Integer);
begin
 inherited Left := Value;
 // do your stuff here
end;

Regards, Geo
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
IExtractImage Delphi 14 164
Newbie Thread Programming 1 117
Downloading email attachments 2 55
drawing animated level bar based on numbers 3 73
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now