How to set SpinGadget() Font Size?
-
IdeasVacuum
- Always Here

- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
How to set SpinGadget() Font Size?
No matter what size the SpinGadget is, the default tiny system font is used. Is there a way to set the font size?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
- RSBasic
- Moderator

- Posts: 1228
- Joined: Thu Dec 31, 2009 11:05 pm
- Location: Gernsbach (Germany)
- Contact:
Re: How to set SpinGadget() Font Size?
SetGadgetFont()
\\Edit:
Get standard font and set font size (only windows):
\\Edit:
Get standard font and set font size (only windows):
Code: Select all
EnableExplicit
;Get standard font
Define NONCLIENTMETRICS.NONCLIENTMETRICS
NONCLIENTMETRICS\cbSize = SizeOf(NONCLIENTMETRICS)
SystemParametersInfo_(#SPI_GETNONCLIENTMETRICS, 0, @NONCLIENTMETRICS, 0)
If OpenWindow(0, 0, 0, 500, 400, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
SpinGadget(1, 10, 10, 100, 50, 0, 100, #PB_Spin_Numeric)
SetGadgetState(1, 50)
LoadFont(1, PeekS(@NONCLIENTMETRICS\lfCaptionFont\lfFaceName[0]), 20)
SetGadgetFont(1, FontID(1))
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
End
EndSelect
ForEver
EndIf-
IdeasVacuum
- Always Here

- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: How to set SpinGadget() Font Size?
...Thanks RSBasic, that's a lot easier than I was expecting! Would make a good addition to your WinAPI Library 
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: How to set SpinGadget() Font Size?
Code: Select all
If OpenWindow(0, 0, 0, 140, 70, "SpinGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
SpinGadget (0, 20, 20, 90, 35, 0, 1000)
fID = GetGadgetFont(0)
GetObject_(fID, SizeOf(LOGFONT), @lf.LOGFONT)
LoadFont(0,PeekS(@lf\lfFaceName),16)
SetGadgetFont(0,FontID(0))
SetGadgetState (0, 5) : SetGadgetText(0, "5") ; set initial value
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
If EventGadget() = 0
SetGadgetText(0, Str(GetGadgetState(0)))
EndIf
EndIf
Until Event = #PB_Event_CloseWindow
EndIf
Egypt my love
-
IdeasVacuum
- Always Here

- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: How to set SpinGadget() Font Size?
Hi Rashad, that method works perfectly too. 
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.

