Hi,
I'm working on a PB demo program which will feature some "beginner examples".
I'm having trouble making this small Font / Trackbar example scroll smoothly. I've tried various combinations without too much success.
The trackbar value appears to "start at zero" every time you use the
right arrow to scroll the trackbar.
Any ideas?
Code: Select all
;
; ------------------------------------------------------------
;
; PureBasic - Horizontal Scroll Bar example file
;
; (c) 2002 - Fantaisie Software
;
; ------------------------------------------------------------
;
hWnd = OpenWindow(0, 200, 200, 320, 240, #PB_Window_WindowCentered | #PB_Window_SystemMenu | #PB_Window_MaximizeGadget, "A Trackbar Example Window")
If CreateGadgetList(hWnd)
;Slider
TrackBarGadget(1, 10, 168, 310, 25, 1, 100)
; Quit button
ButtonGadget(2, 200, 210, 90, 25,"Quit")
TextGadget(3, 10, 10, 220, 150, "Slide the Trackbar control")
EndIf
;Message Loop
Repeat
EventID.l = WaitWindowEvent()
Select EventID
Case #PB_EventGadget ; gadget event happened
Select EventGadgetID() ; find out which gadget
Case 1 ; if Trackbar Control (Scroll bar)
Result.l = GetGadgetState(1)
LoadFont(1, "Arial", Result)
;UseFont(1)
SetGadgetFont(FontID())
;SetGadgetText(3, Str(result))
TextGadget(3, 10, 10, 220, 150, Str(Result))
Case 2 ; Quit button
EventID = #PB_EventCloseWindow
Default
EndSelect
EndSelect
Until EventID = #PB_EventCloseWindow
; ----------------------------------------
End
