Board index » kylix » Change Font for Application.MessageBox

Change Font for Application.MessageBox


2005-12-02 08:15:47 AM
kylix1
Suse 9.3, Kylix 3
I would like to use Application.MessageBox to display a message
to the user. The only issue I have is that the font that is
used in the MessageBox is way too small to be read.
So the questions are:
Where does Application.MessageBox get it's font setting from?
Can this be changed in the application?
I tried changing Font sizes, types in the Control Center,
(figuring that Kylix was using system settings for fonts) but
this appears to have no effect on the font of the text displayed
in the Application.MessageBox.
I know that I could create a dialog box and get the font however
I want but the MessageBox would be fine if I can change the font
size to be more readable.
Any suggestions? Thanks in Advance.
 
 

Re:Change Font for Application.MessageBox

theo < XXXX@XXXXX.COM >wrote:
Quote
Although this sounds a bit strange to me, you can always change the
font-size of the application by setting preferrably in the .dpr

Application.Initialize;
Application.Font.size:=22;
Application.CreateForm(TForm1, Form1);
Application.Run;

The Fonts will be big in this example.

In other cases, when porting the source from VCL and everything looks
too small, setting Scaled:=False on the main form may help.
The above code works fine to change the text in the MessageBox
but the side effect of doing that is that other controls on the
form are affected (like MenuItems and button captions for
example) This was the first thing that I tried orginally.
I was asking (or at least I meant to ask)
if there was a way I can change just the font
for the message text in the Application.MessageBox. In my case
the text in the MessageBox is so small that it is nearly
impossible to read. I was hoping to just change the font in
that one specific place as the rest of the fonts look fine.
The issue, I believe, is that because MessageBox creates and
destroys the dialog in one call, I have no way to get access
to the controls on the Dialog to make any changes.
Any other suggestions?
 

Re:Change Font for Application.MessageBox

Jim schrieb:
Quote
Suse 9.3, Kylix 3

I would like to use Application.MessageBox to display a message
to the user. The only issue I have is that the font that is
used in the MessageBox is way too small to be read.

So the questions are:
Where does Application.MessageBox get it's font setting from?
Can this be changed in the application?

I tried changing Font sizes, types in the Control Center,
(figuring that Kylix was using system settings for fonts) but
this appears to have no effect on the font of the text displayed
in the Application.MessageBox.

I know that I could create a dialog box and get the font however
I want but the MessageBox would be fine if I can change the font
size to be more readable.

Any suggestions? Thanks in Advance.

Although this sounds a bit strange to me, you can always change the
font-size of the application by setting preferrably in the .dpr
Application.Initialize;
Application.Font.size:=22;
Application.CreateForm(TForm1, Form1);
Application.Run;
The Fonts will be big in this example.
In other cases, when porting the source from VCL and everything looks
too small, setting Scaled:=False on the main form may help.
 

{smallsort}

Re:Change Font for Application.MessageBox

"Jim" < XXXX@XXXXX.COM >wrote:
Quote

theo < XXXX@XXXXX.COM >wrote:

>Although this sounds a bit strange to me, you can always change the
>font-size of the application by setting preferrably in the .dpr
>
>Application.Initialize;
>Application.Font.size:=22;
>Application.CreateForm(TForm1, Form1);
>Application.Run;
>
>The Fonts will be big in this example.
>
>In other cases, when porting the source from VCL and everything looks
>too small, setting Scaled:=False on the main form may help.

The above code works fine to change the text in the MessageBox
but the side effect of doing that is that other controls on the
form are affected (like MenuItems and button captions for
example) This was the first thing that I tried orginally.

I was asking (or at least I meant to ask)
if there was a way I can change just the font
for the message text in the Application.MessageBox. In my case
the text in the MessageBox is so small that it is nearly
impossible to read. I was hoping to just change the font in
that one specific place as the rest of the fonts look fine.

The issue, I believe, is that because MessageBox creates and
destroys the dialog in one call, I have no way to get access
to the controls on the Dialog to make any changes.

Any other suggestions?



var
OldFontSize: integer;
begin
OldFontSize := Application.Font.Size;
try
Application.Font.Size := 22;
Application.MessageBox('OK', 'OK', [smbOK], smsInformation,
smbOK);
finally
Application.Font.Size := OldFontSize;
end;
end;