Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide to Clip-4-Win version 3.0 - <b>choosefont()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
ChooseFont()
Get the user to select a font
------------------------------------------------------------------------------

Syntax
ChooseFont( <aFont>, [ @ <nPointSize> ] , [ <nFlags> ] ,
            [ @ <nColour> ] , [ @ <cStyle> ] , [ <nFontType> ] ,
            [ <nMin> ] , [ <nMax> ] )   -->   aFont

Arguments
<aFont> is an array specifying the characteristics of the new
font.  This array must have 14 elements.  (The purpose of each
element is indicated by the LF_* values defined in FONT.CH.)
The user's choices will be copied into this array.

<nPointSize> is an optional parameter used to return the size
of the selected font (in tenths of a point).

<nFlags> is an optional parameter specifying the exact
behaviour of the dialog box shown to the user.  (Use the CF_*
values defined in COMMDLG.CH.)

<nColour> is an optional parameter used to set the default
colour and to return the colour chosen.  (The RGB() macro can
be used to set the value.)  The default is black.

<cStyle> is an optional parameter specifying the style
description of the font.

<nFontType> is an optional parameter specifying the type of
the font.

<nMin>,<nMax> are optional parameters used to limit the size
of font the user can select.

Returns
The returned value is an array specifying the font selected by
the user, or the value NIL if the user cancelled the dialog
(or if an error is detected).

Description
This function displays a Windows-defined dialog box that
allows the user to choose a font using the mouse and/or
keyboard.  The user can experiment on-screen whilst choosing.

If an array is returned, it may be used for subsequent calls
to the ChooseFont() or CreateFont() functions.

Example
aFont = array(14)
aFont[ LF_FaceName ] = "Arial"
aFont = ChooseFont( aFont, , , @nColour )
if aFont != nil
     hFont = CreateFont( aFont )
     if hFont != 0
          // use the font and/or colour
          // . . .
          // when done, de-select the font using SelectObject()
     endif
     DeleteObject( hFont )
endif


See Also: CreateFont() DeleteObject()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson