Class XbpFontDialog() Foundation

Class function of the XbpFontDialog class.

Superclass
Description

The XbpFontDialog class provides the default font dialog that allows the user to define XbpFont objects at runtime of an Xbase++ program. The font dialog is derived from the XbpSysWindow class (see the XbpSysWindow class for more information). After an XbpFontDialog object has been created, values can be assigned to its instance variables to configure the font dialog. The dialog itself is provided by the operating system in the method :create(). The :display()method displays and activates the font dialog. This opens a window where font attributes can be set. Before the font dialog is visible on the screen three methods must be executed. The simplest approach is shown in the following program lines:

oFontDlg := XbpFontDialog():new()  // Create object 
// configure font dialog 
oFontDlg:create()                  // Request dialog 
oFont := oFontDlg:display()        // Activate dialog 

System dialogs such as the font dialog are always modal under Windows. The method :display()returns an XbpFont object and an Xbase++ program waits until the font dialog is closed.

Class methods
:new()
Creates an instance of the XbpFontDialog class.
Configuration
:codePage
Determines whether the code page (character set) of the font is selectable.
:defaultCodePage
Specifies the initial code page (character set) selected in the font dialog.
:defaultFamilyName
Specifies the font family of the font initially selected in the font dialog.
:defaultSize
Specifies the initial font size selected in the font dialog.
:defaultItalic
Specifies whether the initial font selected in the font dialog is italic.
:defaultWeightClass
Specifies the weight of the font initially selected in the font dialog.
:effects
Determines whether the controls for choosing font effects are displayed.
:familyName
Specifies the family name (deprecated)
:fixedOnly
Determines whether only non-proportional fonts are displayed.
:name
Determines whether the "Name" combo box for selecting different fonts is enabled.
:nominalPointSize
Specifies the point size (deprecated)
:previewFGClr
Determines the foreground color for the window containing the font example.
:printerPS
Contains the presentation space for a printer.
:screenPS
Contains the presentation space for the screen.
:size
Determines whether the "Size" combo box for selecting different type sizes is enabled.
:strikeOut
Determines whether the "Strikeout" check box for requesting a strikeout font is enabled.
:style
Determines whether the "Style" combo box for selecting different font styles is enabled.
:synthesizeFonts
Determines whether to synthesize non-available font attributes.
:title
Determines the character string for the title bar of the XbpFontDialog window.
:underscore
Determines whether the "Underscore" check box for requesting an underscored font is enabled.
:vectorOnly
Determines whether only vector fonts are displayed.
:viewPrinterFonts
Determines whether to include printer fonts.
:viewScreenFonts
Determines whether to include screen fonts.
Life cycle
:create()
Requests the font dialog from the operating system.
:destroy()
Releases the system resources of the XbpFontDialog object.
Methods
:display()
Displays the font dialog.
Examples
Using the font dialog
// This example demonstrates the basic process for using 
// an XbpFontDialog object. A font dialog is created and 
// displayed in the modal operating mode. As long as the 
// user continues to select fonts, the :compoundName for 
// each font selected is displayed in that font. 

#include "Xbp.ch" 

PROCEDURE Main 
   LOCAL oFont, oFontDlg 
   SETCOLOR( "N/W" ) 
   CLS 
                                    // Create XbpFontDialog object 
   oFontDlg            := XbpFontDialog():New() 
   oFontDlg:familyName := "Times New Roman" 
   oFontDlg:create()                // Request font dialog 

                                    // Allow font to be selected 
   DO WHILE ( oFont := ;            // using modal operation 
              oFontDlg:display( XBP_DISP_APPMODAL ) ) <> NIL 
      CLS 

      GraSetFont ( , oFont )        // Display font name 
      GraStringAt( , {10,300}, oFont:compoundName ) 

                                    // Assign current font name 
      oFontDlg:familyName := oFont:familyName // as default 
      oFont:destroy()                         // Destroy font 

   ENDDO 

   oFontDlg:destroy()               // Destroy font dialog 
RETURN 

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.