Solved

TFont property

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
build html 5 client that connect to indy Tidtcpserver 3 350
Delphi cmd execution 6 55
delphi parse string to params 3 97
CheckListBox usage 3 50
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…
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, f…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

911 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

17 Experts available now in Live!

Get 1:1 Help Now