Skip to content

Class: FontDialog

Properties | Events | Methods | Index of Classes

Permits users to select fonts

Hierarchy

cObject > FontDialog

Show full hierarchy and direct subclasses

Library: Windows Application Class Library

Package: FONT_DLG.PKG

Description

FontDialog is used to permit users to select fonts. It is an encapsulation of the Windows Common Font Dialog. All aspects of the dialog can be set before it is displayed, and queried upon its return.

Usage

DEFERRED_VIEW Activate_FontChangeRV FOR ;
;
Object FontChangeRV is a ReportView
    Set Label to "Font Change"
    Set Size to 206 313
    Set Location to 6 6

    Object oFontTextBox is a Textbox
      Set Label To "The quick brown fox jumps over the lazy dog"
      Set FontSize To 4 0
      Set Size     To 10 142
      Set Location To 10 13
    End_Object

    Object FontButton is a Button
      Set Label    To "Change Font"
      Set Location To 166 243

      Procedure OnClick
        Integer iSelected
        handle hoFontDialog

        //*** Create a font dialog object
        Get Create U_FontDialog to hoFontDialog

        //*** Let the user select a font, if one was selected 
        //*** copy selection to the textbox  
        Get FontDialog of hoFontDialog to iSelected
        If iSelected Begin
          Set TypeFace of oFontTextBox to (FaceName(hoFontDialog))
          Set FontSize of oFontTextBox to (FontHeight(hoFontDlg)) (FontWidth(hoFontDialog))
          Set FontWeight of oFontTextBox to (FontWeight(hoFontDialog))
          Set FontItalics of oFontTextBox to (FontItalic(hoFontDialog))
          Set FontUnderline of oFontTextBox to (FontUnderline(hoFontDialog))
        End

        //*** Destroy the font dialog object
        Send Destroy of hoFontDialog
      End_Procedure

    End_Object
CD_End_Object

Syntax

Use Font_Dlg.pkg

Object oObjectName is a FontDialog
End_Object

Note

This class is a DataFlex wrapper for the Windows API common font dialog. You are able to handle all properties that can be set by the Windows API common font dialog. It is possible that not all of those font properties are supported by all DataFlex objects.