Solved

Access to the property of ancestor class

Posted on 2001-09-13
1
201 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

690 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