FontDialog

(Engine-Level Function)

Description: Displays a threaded system common font dialog box.
Returns: Error code
Usage: Script Only.
Function Groups: Graphics
Related to: Font | PrintDialogBox
Threaded: Yes
Format: FontDialog(Name, CharSet, Height, Rotation, Weight, Italic, Fixed [, Display, Result])
Parameters:  
Name
Required. Any text expression which gives the name of the font. This must be the same as the Microsoft Windows™ name for the font. For example, "MS Sans Serif".
CharSet
Required. Any numeric expression giving the Font Character Sets for this font.
If you are uncertain as to a valid value, set CharSet to 0, thereby obtaining English characters.
The keyword, DEFAULT_CHARSET may be used, auto-selecting the character set based on the configured Windows locale. OEM_CHARSET will do the same, but will use the DOS equivalent.
Height
Required. Any numeric expression giving the height of the font in points.
Rotation
Required. Any numeric expression giving the rotation of each character in degrees.
Weight
Required. Any numeric expression giving the weight of the font. Larger numbers give a more bold appearance. The range is 0 to 9.
Italic
Required. Any logical expression. If true (non-0), the italicized version of the font is used. If false (0), the normal version is used.
Fixed
Required. Any logical expression. If true (non-0), all of the characters used by the font will be the same width and height, that of the largest character. If false (0), and the font is a proportional or a true type font they may have different sized characters.
Display
An optional parameter that gives a list of fonts to display. Display can be set to one of the following values.

Display

Font List

0

All fonts

1

Screen fonts only

2

Printer fonts only

If the value is invalid, all fonts will be displayed. If out of range, then the function call is not valid.

Result
An optional parameter that is a variable whose value will be set to 1 if the OK button on the font dialog is clicked, and 0 if the Cancel button on the font dialog is clicked.
Comments:

The first seven parameters are originally read in to set the default values for the dialog box and if they are VTScada variables, they will be set to the attributes for the font chosen by the user in the dialog box.
In addition to the Result parameter, the function itself will return an error code to indicate whether the dialog was successfully opened. A "1" indicates failure to open while a "0" indicates success.

Within an Anywhere Client session, this function does nothing.

Example:

[
  Title = "OverviewLabel";
  Color;

  NewFont; 
  Name      = "Century Gothic"; 
  CharSet   = 0; 
  Ht        = 14; 
  Rotate    = 0; 
  Wt        = 5; 
  Italic    = 1; 
  CharFixed = 1; 
  WasSet    = 0; 
]

Main [
  { Display the chosen font } 
  ZText(100, 100, Concat("A ", Name, " Font"), 12, NewFont);
  NewFont = Font(Name, CharSet, Ht, Rotate, Wt, Italic, CharFixed); 
  { Set the font } 
  If ZButton(200, 130, 300, 110, "Set Font", 1) && Valid(WasSet); 
  [ 
    WasSet = Invalid; 
    FontDialog(Name { Font name }, 
               CharSet { Character set }, 
               Wt { Height in points }, 
               Rotate { Rotation in degrees }, 
               Wt { Weight 0 - 10 }, 
               Italic { Italics flag }, 
               CharFixed { Fixed pitch flag }, 
               0 { All font options }, 
               WasSet { Set when dlg closes }); 
  ] 
]