FONTDIALOG (return chosen font)

Top  Previous  Next

 

FONTDIALOG([title] ,typeface [,size] [,color] [,style] [,added] )

FONTDIALOG

Displays the standard Windows font choice dialog box to allow the user to choose a font.

title

A string constant or variable containing the title to place on the font choice dialog. If omitted, a default title is supplied by Windows.

typeface

A string variable (STRING in Clarion, CLASTRING in Clarion#) to receive the name of the chosen font.

size

A SREAL to receive the size (in points) of the chosen font.

color

A SIGNED integer variable to receive the red, green, and blue values for the color of the chosen font in the low-order three bytes.

style

A SIGNED integer variable to receive the strike weight and style of the chosen font.

added

An integer constant or variable that specifies adding screen or printer fonts, or both, to the list of available fonts. Zero (0) adds screen fonts, one (1) adds printer fonts, two (2) adds both, four (4) adds true type only fonts, and eight (8) adds fixed pitch only fonts. If omitted, only Windows registered fonts are listed. . Parameter not valid in Clarion#

The FONTDIALOG procedure displays the Windows standard font choice dialog box to allow the user to choose a font. When called, any values in the parameters set the default font values presented to the user in the font choice dialog. They also receive the user's choice when the user presses the "OK" button on the dialog. FONTDIALOG returns zero (0) if the user pressed the Cancel button, or one (1) if the user pressed the "OK" button.

The FONTDIALOG procedure is limited to fonts of the ANSI or Default character set, to use another character set use the FONTDIALOGA function.

Return Data Type:

BOOL

Example:

MDIChild1  WINDOW('View Text File'),AT(0,0,320,200),MDI,SYSTEM,HVSCROLL

          !window controls

          END

 

Typeface   STRING(31) !or CLASTRING for Clarion#

FontSize   SIGNED

FontColor  LONG

FontStyle  LONG

 

CODE

OPEN(MDIChild1)                                   !open the window

IF FONTDIALOG('Choose Display Font',Typeface,FontSize,FontColor,FontStyle,0)

 SETFONT(0,Typeface,FontSize,FontColor,FontStyle) !Set window font

ELSE

 SETFONT(0,'Arial',12)                            !Set default font

END

ACCEPT

 !Window handling code

END

 

See Also:

FONT(set default font)

Font Support Quick Summary