FontRequester()

Syntax

Result = FontRequester(FontName$, FontSize, Flags [, Color [, Style]])
Description
Opens the standard requester to choose a font. If the user cancels the requester, the return value is 0, else it's 1. 'FontName$' and 'FontSize' can be used to set the default font.

The functions SelectedFontColor(), SelectedFontName(), SelectedFontSize() and SelectedFontStyle() can be used after a successful call to get the needed information about the selected font.

The optional 'Color' parameter can be used to set the default color when the requester is opened. A valid color value you can get with the function RGB().

The optional 'Style' parameter can be used to set the default style when the requester is opened. See SelectedFontStyle() for available styles.

'Flags' can be one of the following values:
  #PB_FontRequester_Effects : Enable the requesters effects, including color chooser.
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) 

Supported OS

All

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