Blame it on all that pretty gloss you stare at all day longsrod wrote:srod = daft twit!


Code: Select all
Global oldProc, progressFlag
Procedure progressCallback(hWnd, uMsg, wParam, lParam)
Protected result = CallWindowProc_(oldProc, hWnd, uMsg, wParam, lParam)
Static count
Select uMsg
Case #WM_TIMER
If wParam = 100 ;This is our timer.
count+1 ;A count of the number of times this timer is called consecutively.
Else
count=0
EndIf
If count = 10 ;Should be enough to determine that the 'other' timer has completed. Increase this value if you get problems.
KillTimer_(hWnd, 100)
count = 0
HideGadget(0,1)
HideGadget(1,0)
EndIf
EndSelect
ProcedureReturn result
EndProcedure
Procedure addtolist()
For n2=0 To 150
AddGadgetItem(1,-1,Str(Random(10000)))
Next n2
EndProcedure
If OpenWindow(0, 0, 0, 600, 100, "ProgressBarGadget Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
ListIconGadget(1,10,10,580,80,"",100)
ProgressBarGadget(0, 10, 40, 580, 20, 0, 200)
oldProc = SetWindowLong_(GadgetID(0), #GWL_WNDPROC, @progressCallback())
HideGadget(1,1)
For n=0 To 200
addtolist()
SetGadgetState(0,n)
Next n
;Create a timer to monitor the 'other' timer which may be running on Vista to finish rendering the progressbar etc.
SetTimer_(GadgetID(0), 100, 10, 0)
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf