?
Solved

Access to the property of ancestor class

Posted on 2001-09-13
1
Medium Priority
?
202 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 120 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

Question has a verified solution.

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

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…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month8 days, 5 hours left to enroll

765 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