SetGadgetFont()

Syntax

SetGadgetFont(#Gadget, FontID)
Description
Changes the font of the specified #Gadget. The UseFont() or FontID() commands can be used to easily obtain a valid FontID.

If #Gadget is set to #PB_Default, the font used by newly created gadgets is changed to the new one.

If 'FontID' is set to #PB_Default, then the system default font will be used.

Example:
  If OpenWindow(0,0,0,222,130,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"SetGadgetFont") And CreateGadgetList(WindowID(0))
    If LoadFont(0,"Arial",16)
      SetGadgetFont(#PB_Default,FontID())   ; Set the loaded Arial 16 font as new standard
    EndIf
    ButtonGadget(0,10,10, 200, 30, "Button - Arial 16")
    SetGadgetFont(#PB_Default,#PB_Default)  ; Set the font settings back to original standard font
    ButtonGadget(1,10,50, 200, 30, "Button - standard")
    If LoadFont(1,"Courier",10,#PB_Font_Bold|#PB_Font_Underline)
      SetGadgetFont(#PB_Default,FontID())   ; Set the loaded Courier 10 font as new standard
    EndIf
    TextGadget(2,10,90,200,40,"Bold + underlined Courier 10 Text",#PB_Text_Center )
    Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
  EndIf

Supported OS

All

<- SetGadgetAttribute() - Gadget Index - SetGadgetItemAttribute() ->