FontRequester()

Syntax

Result = FontRequester(FontName$, FontSize, Flags [, Color [, Style]])
Description
Opens the standard requester to choose a font. The functions SelectedFontColor(), SelectedFontName(), SelectedFontSize() and SelectedFontStyle() can be used after a successful call to get the needed information about the selected font.

Parameters

FontName$ The default font name to use when the requester is opened.
FontSize The default font size to use when the requester is opened.
Flags It can be one of the following values:
  #PB_FontRequester_Effects : Enable the requesters effects, including color chooser (Windows only).
Color (optional) Sets the default color when the requester is opened. A valid color value you can get with the function RGB().
Style (optional) Sets the default style when the requester is opened. See SelectedFontStyle() for available styles.

Return value

Nonzero if a font has been choosen, zero if the user canceled the requester.

Example

  FontName$ = "Arial"   ; set initial font  (could also be blank)
  FontSize  = 14        ; set initial size  (could also be null)
  Result = FontRequester(FontName$, FontSize, #PB_FontRequester_Effects)
  If Result
    Message$ = "You have selected following font:"  + #LF$ 
    Message$ + "Name:  " + SelectedFontName()       + #LF$
    Message$ + "Size:  " + Str(SelectedFontSize())  + #LF$
    Message$ + "Color: " + Str(SelectedFontColor()) + #LF$
    If SelectedFontStyle() & #PB_Font_Bold
      Message$ + "Bold" + #LF$
    EndIf
    If SelectedFontStyle() & #PB_Font_StrikeOut
      Message$ + "StrikeOut" + #LF$
    EndIf
    If SelectedFontStyle() & #PB_Font_Underline
      Message$ + "Underline" + #LF$
    EndIf
  Else 
    Message$ = "The requester was canceled."
  EndIf
  
  MessageRequester("FontRequester", Message$, #PB_MessageRequester_Ok) 

See Also

SelectedFontColor(), SelectedFontName(), SelectedFontSize(), SelectedFontStyle()

Supported OS

All

<- ColorRequester() - Requester Index - InputRequester() ->