Solved

TFont property

Posted on 2001-09-12
4
291 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

Industry Leaders: 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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month11 days, 14 hours left to enroll

623 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