Solved

Access to the property of ancestor class

Posted on 2001-09-13
1
197 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

815 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

13 Experts available now in Live!

Get 1:1 Help Now