Solved

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

Posted on 2007-04-09
2
695 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
2 Comments
 
LVL 5

Accepted Solution

by:
xr1140 earned 500 total points
Comment Utility

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

Author Comment

by:peterkiers
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 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

7 Experts available now in Live!

Get 1:1 Help Now