[Solved] SetGadgetFont ???

Just starting out? Need help? Post your questions and find answers here.
User avatar
Markus
Posts: 8
Joined: Sat Dec 17, 2016 8:59 pm

[Solved] SetGadgetFont ???

Post 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 ) 
Last edited by Markus on Sat Dec 17, 2016 11:17 pm, edited 1 time in total.
User avatar
Markus
Posts: 8
Joined: Sat Dec 17, 2016 8:59 pm

Re: SetGadgetFont ???

Post by Markus »

Ahh , it works only in this "Flat" Mode at Gadget Compiler Options.
TheMexican
Posts: 17
Joined: Sun Jun 07, 2015 5:58 pm

Re: [Solved] SetGadgetFont ???

Post by TheMexican »

Thank you for the tip!!
Post Reply