Solved

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

Posted on 2007-04-09
2
699 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
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

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 The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

809 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