EnableExplicit Define EventID Define a If OpenWindow(0,0,0,500,400,"Window",#PB_Window_SystemMenu|#PB_Window_ScreenCentered) TrackBarGadget(1,10,10,200,50,0,100,0) For a=0 To 100 Step 20 SendMessage_(GadgetID(1),#TBM_SETTIC,0,a) Next Repeat EventID=WaitWindowEvent() If EventID = #PB_Event_CloseWindow End EndIf ForEver EndIf