Page 1 of 1

[Solved] SetGadgetFont ???

Posted: Sat Dec 17, 2016 10:12 pm
by Markus
hi,
have someone an example how to change the ButtonGadget font?
i made a OpenWindow and using a ButtonGadget
had used LoadFont
but if me using SetGadgetFont nothing happens.
me using the free version of SpiderBasic 2.00 (Windows - x86)
i started the source from pc and call the web adress also from phone.
i need a bigger font at phone because i can't read it .

Code: Select all

Debug("Hello World")

; Firefox F11 for Fullscreen
; Window als Browser Hintergrund #PB_Window_Background

myfont=LoadFont(#PB_Any, "times", 30)

Global window=OpenWindow(#PB_Any,0,0,640,480,"Main",#PB_Window_Background)

Debug "Font:"+myfont
Debug "IsFont:"+IsFont(myfont)

SetGadgetFont(#PB_Default,FontID(myfont)) ;???

button=ButtonGadget(#PB_Any, 10, 10, 200, 100, "Click me")

SetGadgetFont(button,FontID(myfont)) ;???

Procedure ButtonHandler()
      Debug "event on gadget #" + EventGadget() 
    
        Select EventType()
          Case #PB_EventType_LeftClick        : Debug "Click with left mouse button"
          Case #PB_EventType_RightClick       : Debug "Click with right mouse button"
          Case #PB_EventType_LeftDoubleClick  : Debug "Double-click with left mouse button"
          Case #PB_EventType_RightDoubleClick : Debug "Double-click with right mouse button"
       EndSelect
    
EndProcedure

Procedure WindowCloseHit()
      Debug "close window on #" + EventWindow() + " " + window
      CloseWindow(window)
EndProcedure

BindGadgetEvent(button, @ButtonHandler())

BindEvent(#PB_Event_CloseWindow  , @WindowCloseHit() , window ) 

Re: SetGadgetFont ???

Posted: Sat Dec 17, 2016 10:41 pm
by Markus
Ahh , it works only in this "Flat" Mode at Gadget Compiler Options.

Re: [Solved] SetGadgetFont ???

Posted: Tue Dec 20, 2016 1:56 pm
by TheMexican
Thank you for the tip!!