Solved

Access to the property of ancestor class

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

840 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