; English forum: http://purebasic.myforums.net/viewtopic.php?t=7262&highlight= ; Author: nessie ; Date: 18. August 2003 ; Input the time using a spin gadget ;********************************** ; Time Spin Gadget ; By Garry Watson aka Nessie ; 17/08/03 ; Use as you please ;********************************** FontID1 = LoadFont(1, "Arial", 12, #PB_Font_Bold) min = 0 spin = 1 hours = 2 sepa = 3 mins = 4 hr=12:hr$="12" hWnd = OpenWindow(0,0,0,100,100,#PB_Window_ScreenCentered|#PB_Window_SystemMenu,"TIME") If hwnd=0 Or CreateGadgetList(hwnd)=0:End:EndIf If hr=00:hr$="00":EndIf If state=0:state$="00":EndIf If hr<10:hr$="0"+Str(hr):EndIf If hr>9:hr$=Str(hr):EndIf If state<10:state$="0"+Str(state):EndIf If state>9:state$=Str(state):EndIf StringGadget(5, 25, 29, 49, 23,"") DisableGadget(5,1) StringGadget(hours, 26, 30, 19, 20, hr$, #PB_String_Numeric | #PB_String_BorderLess) SetGadgetFont(hours, FontID1) SendMessage_(GadgetID(hours), #EM_LIMITTEXT, 2, 0) StringGadget(sepa, 45, 30, 6, 20, ":", #PB_String_BorderLess) SetGadgetFont(sepa, FontID1) SendMessage_(GadgetID(sepa), #EM_LIMITTEXT, 1, 0) SpinGadget(spin, 72, 30, 10, 20, -1, 60) StringGadget(mins, 51, 30, 20, 20, state$, #PB_String_Numeric | #PB_String_BorderLess) SetGadgetFont(mins, FontID1) SendMessage_(GadgetID(mins), #EM_LIMITTEXT, 2, 0) Repeat state=Val(GetGadgetText(4)):SetGadgetState(spin,state) string = EventGadgetID () If string=3 : ActivateGadget(4) : EndIf EventID.l = WaitWindowEvent() If eventid = #PB_EventGadget ElseIf eventid = 15 EndIf Select EventID Case #PB_EventGadget Select EventGadgetID() Case spin hr=Val(GetGadgetText(2)) state=GetGadgetState(spin) evtp=EventType() If state>60:SetGadgetState(spin,59):hr=hr-1:EndIf If state>59 And state <70 :hr=hr+1:SetGadgetState(spin,0):state=0:EndIf If state<10:SetGadgetText(4,"0"+Str(GetGadgetState(spin))):EndIf If state>9:SetGadgetText(4,Str(GetGadgetState(spin))):EndIf If hr<0 :hr=23:EndIf If hr>23:hr=0:EndIf If hr<10:SetGadgetText(2,"0"+Str(hr)):EndIf If hr>9:SetGadgetText(2,Str(hr)):EndIf EndSelect EndSelect Until EventID = #PB_Event_CloseWindow ; ExecutableFormat=Windows ; FirstLine=1 ; EnableXP ; EOF