Table of Contents

CHOOSEFONT method (System)

Description

Displays the "Choose Font" Windows Common Dialog Box to allow the user to select a font:

Syntax

Font = Exec_Method( "SYSTEM",          
                    "CHOOSEFILE",      
                    OwnerWindow,       
                    ChooseFontOptions, 
                    HideColors )

Parameters

NameRequiredDescription
OwnerWindowNoID of the parent window for the dialog. This can be null, in which case the parent window is the desktop.
ChooseFontOptionsNoContains an @Fm-delimited dynamic array of options that control the behavior of the dialog. It has the following structure:

<1> @Svm-delimited FONT structure
<2> Flags
HideColorsNoIf TRUE$ then hide the color selection combobox.

Returns

An @Svm-delimited FONT structure in the format:

<0,0,1>  FaceName
 
<0,0,2>  Height
 
<0,0,3>  Weight
 
<0,0,4>  Italic
 
<0,0,5>  Underline
 
<0,0,6>  Width
 
<0,0,7>  CharSet
 
<0,0,8>  PitchAndFamily
 
<0,0,9>  Strikeout
 
<0,0,10> OutPrecision
 
<0,0,11> ClipPrecision
 
<0,0,12> Quality

If the HideColors option is not set then the selected color RGB values are appended to the structure like so:

<0,0,13> Red
 
<0,0,14> Green
 
<0,0,15> Blue

Remarks

The ChooseFontOptions argument is composed of two fields which control the behavior of the dialog – each field is described fully below:

FieldNameDescription
<1>InitialFontSpecifies the font to preselect in the dialog. This can be:

1. An @Svm-delimited structure in the same format as the return value described above, or
2. The name of an existing control whose FONT property is used to preselect in the dialog.
<2>FlagsA set of bitmask flags that specify the dialog behavior. These are fully described in the Microsoft documentation for the "flags" member of the CHOOSEFONT structure, and equates constants for these flags can be found in the MSWIN_CHOOSEFONT_EQUATES insert record (See below for an example of using them).

The CHOOSEFONT method is basically a wrapper around the ChooseFont Windows API function, so it is worth examining at the documentation for this on the MSDN website to get a better idea of the capabilities of this method.

Equated constants for use with the CHOOSEFONT method can be found in the PS_CHOOSEFONT_EQUATES and MSWIN_CHOOSEFONT_EQUATES insert records.

See Also

FONT property