Font Question

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Krysle
Newbie
Posts: 7
Joined: Thu Jan 15, 2009 10:34 pm
Location: United States
Contact:

Font Question

Post by Krysle » Thu Jan 22, 2009 6:22 pm

Hi,

I am looking for some help on how to get a consistant dialog presentation across different platforms. I designed a dialog on Vista using Arial 8pt font but when I run it on my XP, the lettering runs off the buttons.

Any suggestions on how I can resolve this?

User avatar
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

Post by Rain » Fri Jan 23, 2009 5:54 pm

Use SetDialogObjectFont

Code Example: SetDialogObjectFont>Dialog1,msButton1,Ariel,8,1,0

Dialog Example:

Code: Select all

Dialog>Dialog1
   Caption=Dialog1
   Width=190
   Height=94
   Top=162
   Left=503
   Button=msButton1,8,16,75,25,0
   Button=msButton2,96,16,75,25,0
EndDialog>Dialog1

SetDialogObjectFont>Dialog1,msButton1,Ariel,8,1,0
SetDialogObjectFont>Dialog1,msButton2,Ariel,8,1,0

Show>Dialog1,r
From the help file
SetDialogObjectFont>Dialog_Name,Object_Name,Font_Name,Font_Size,Font_Style,Font_Color

Sets the font characteristics of the specified dialog object.

If you are unsure of the name of the object edit the dialog in the Dialog Designer and double click on the object to see it's name.


Font_Style can be one of:
0: Normal

1: Bold

2: Italic

3: Underline

4: Strikeout

Use the RGB function to create a color code. 0 is black.


Abbreviation: SDF

Example:

SetDialogObjectFont>Dialog1,msMemo2,Arial,8,1,0
I hope this helps

Krysle
Newbie
Posts: 7
Joined: Thu Jan 15, 2009 10:34 pm
Location: United States
Contact:

Post by Krysle » Sat Jan 24, 2009 10:27 pm

Thank you for the reply. I am actually using...

SetDialogObjectFont>MainDialog,,Arial,8,1,0
(Sets all objects if Object_Name left blank)

However, the problem is that the font size doesn't appear correctly on my laptop. I am setting this up for more than just myself to use so was hoping there was a generic solution. Thx again.

User avatar
Phil Pendlebury
Automation Wizard
Posts: 543
Joined: Tue Jan 16, 2007 9:00 am
Contact:

Post by Phil Pendlebury » Tue Jan 27, 2009 8:41 pm

Krysle wrote:Thank you for the reply. I am actually using...

SetDialogObjectFont>MainDialog,,Arial,8,1,0
(Sets all objects if Object_Name left blank)

However, the problem is that the font size doesn't appear correctly on my laptop. I am setting this up for more than just myself to use so was hoping there was a generic solution. Thx again.
I use an .ini file with the font and font size settable by the user to get around the various different system defaults.

An excerpt below:

FROM THE .INI FILE

Code: Select all

[other_options]
def_font=Arial
def_font_size=8
WITHIN THE SCRIPT

Code: Select all

// READ THE DEFS
ReadIniFile>%SCRIPT_DIR%\ini\defs.ini,other_options,def_font,deffont
ReadIniFile>%SCRIPT_DIR%\ini\defs.ini,other_options,def_font_size,deffontsize

// SET THE FONT STUFF
SetDialogObjectFont>MainDialog,,%deffont%,%deffontsize%,0,0
Obviously this is all part of a much larger script. So there are reasons for why I need to do it in that way which may not be obvious in a small clip from the script.

The user is then directed to edit the values in the INI file to suit his display.
Phil Pendlebury - Linktree

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts