Class XbpFontDialog() Foundation
Class function of the XbpFontDialog class.
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.
// 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
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.