FontDialog
Name$,Size, Flags$ = FontDialog(Name$, Size, Flags)
 
Parameters:

    Name$ = The Name of the pre-selected font in the dialog
    Size = The size of pre-selected font
    Flags = The style flags for the pre-selected font
Returns:

    Name$,Size, Flags$ = Returns the Name$, size and display flags of the users selection.
 

     FontDialog opens a windows font selection dialog. The dialog allows the user to pick and from the available Windows True Type & Windows Bitmap fonts on this computer. Not all fonts can be loaded though into PB though.


      * The FontDialog returns three values. The Font Name you selected, it's size and it's display flags. You can use these values when loading the font with LoadFont or LoadNewFont.



FACTS:



      * Use the DialogNotCanceled to query if the user canceled out of this dialog or not.

      * FontDialog is not asynchronous, so the PlayBasic application will halt while the dialog is open.




 
Example Source: Download This Example
; Include the Dialogs library in this program
  #Include "PBDialogs"
  
; Clear the Screen to Blue
  Cls RGB(0,0,255)
  
  
  
; Call the Windows Font Dialog Function.
; Here's we're asking it start with pre-selected
; font (courier) of size 18, with no special flags
  
  Name$,Size,Flags=FontDialog("Courier",15,0)
  
; Check if the USER clicked the cancel button
; while using this dialog ? - If they didn't cancel
; then wahatever they entered we'll accept
  If DialogNotCanceled()=true
     
   ;
     Print "You Selected To Change Fonts To"
     Print Name$
     Print Size
     Print Flags
     
   ; Try and load this font input PlayBasic.
   ;  NOTE: PB can't load all True Type Fonts...
     ThisFont=LoadNewFont(Name$,Size,Flags)
     
   ; Check if the font loaded,
     If GetFontStatus(ThisFont)
        
      ; Set This new font as the current display font
        SetFont ThisFont
        
      ; render some text in the newly loaded font
        Print "This Text Will Be Displayed In The New Font"
        
     EndIf
     
  Else
     Print "You Canceled This Dialog"
     
  EndIf
  
  
  Sync
  WaitKey
  
  
  
  
  
  
 
Related Info: FolderDialog | LoadDialog | SaveDialog :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com