Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2007-04-09
2
Medium Priority
?
706 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 2000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

670 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