Solved

TFont property

Posted on 2001-09-12
4
290 Views
Last Modified: 2013-11-23
Hi
I create component with object property (in particular TFont):

TMyComp = class(TLabel)
private
  FFont: TFont;
  procedure SetFont(Value: TFont);
...........
published
  property Font: TFont read FFont write SetFont;
end;

procedure SetFont(Value: TFont);
begin
  FFont.Assign(Value);
end;

Matter-of-course I create and destroy FFont into constructor and destructor.

Using this component the method SetFont is fired when I peform the next:

......
MyComp.Font := Form1.Font;
......

But how can I make SetFont to be fired in case of:

......
MyComp.Font.Size := 72;
......

It sets MyComp.Font.Size to 72 but I need some others actions to be peformed on this event.

Tanks in advance.
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
  • 2
4 Comments
 
LVL 6

Expert Comment

by:OlegP
ID: 6478670
It is impossible
0
 
LVL 8

Accepted Solution

by:
TOndrej earned 50 total points
ID: 6478725
If you need notification when the font's changed use OnChange, e.g.:

TMyComp = class(...)
private
  FFont: TFont;

  procedure FontChange(Sender: TObject);
public
  constructor Create(AOwner: TComponent); override;
  destructor Destroy; override;
end;

procedure TMyComp.FontChange(Sender: TObject);
begin
  // do your other actions here
end;

constructor TMyComp.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FFont := TFont.Create;
  FFont := FontChange;
end;

destructor TMyComp.Destroy;
begin
  FFont.OnChange := nil;
  FFont.Free;
  inherited Destroy;
end;
0
 
LVL 1

Author Comment

by:vterekh
ID: 6478758
2 TOndrej

Thanks,
I've been trying to locate this in VCL but unfortunately I missed this technique.
0
 
LVL 8

Expert Comment

by:TOndrej
ID: 6478777
have a look at TCanvas for example
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
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…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

734 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