Solved

How to pass FontDialog1.Font.Name to component variable FontName

Posted on 2007-04-09
2
704 Views
Last Modified: 2008-02-07
Hi everyone,

I made this procedure to pass the fontDialog.Font.Name and Size to
the variable FontName and FontSize stored in my component.

Procedure TMainForm.ChangeFont1Click(Sender: TObject);
begin
 FontDialog1.Font.Name:=MyDrawingPanel1.FontName;
 FontDialog1.Font.Size:=MyDrawingPanel1.FontSize;
  if FontDialog1.Execute() then
    begin
    MyDrawingPanel1.FontName := FontDialog1.Font.Name;
    MyDrawingPanel1.FontSize := FontDialog1.Font.Size;
    end;
end

I get the message:   [Error] Main.pas(346): Undeclared identifier: 'FontName'
                                 [Error] Main.pas(347): Undeclared identifier: 'FontSize'

How can I pass the FontDialog.Font.Name and FontDialog.Font.Size to my
component variables FontName and FontSize?

This is what i have in de contstructor of the component:

  FontName := 'Terminal';
  FontSize := 9;
  Font.Size := FontSize;
  Font.Name := FontName;

Who can help me?

P.
0
Comment
Question by:peterkiers
[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 Comments
 
LVL 5

Accepted Solution

by:
xr1140 earned 500 total points
ID: 18876798

make sure FontSize/ FontName are set in your component as public properties
0
 
LVL 1

Author Comment

by:peterkiers
ID: 18876879
I made it like this and it works

procedure TMainForm.ChangeFont1Click(Sender: TObject);
begin
 FontDialog1.Font.Name:=MyDrawingPanel1.FontName;
 FontDialog1.Font.Size:=MyDrawingPanel1.FontSize;
  if FontDialog1.Execute() then
    begin
    MyDrawingPanel1.FontName := FontDialog1.Font.Name;
    MyDrawingPanel1.FontSize := FontDialog1.Font.Size;
    MyDrawingPanel1.Invalidate;
    end;
end;

Thanks
0

Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
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: …
Suggested Courses
Course of the Month6 days, 3 hours left to enroll

627 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