A Replacement For DateGadget

Just starting out? Need help? Post your questions and find answers here.
Jumbuck
User
User
Posts: 63
Joined: Mon Nov 03, 2008 8:30 am
Location: Australia

A Replacement For DateGadget

Post by Jumbuck »

I found this while searching. Need something other than PB DateGadget and this appears
to be the answer.
Can somebody show me how to GET the displayed date INTO a STRING and how to
SET a date into the display FROM a STRING.

Code: Select all

OpenWindow(0,200,200,200,200,"test",#PB_Window_SystemMenu)
  picker1=CreateWindowEx_(0,"SysDateTimePick32","",#WS_CHILD|#WS_VISIBLE|12+2,10,10,120,25,WindowID(0),0,GetModuleHandle_(0),0)
  
Repeat
  EventID=WaitWindowEvent()
   
Until EventID=#PB_Event_CloseWindow

CloseWindow(0)
Thanks Cressida
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4972
Joined: Sun Apr 12, 2009 6:27 am

Re: A Replacement For DateGadget

Post by RASHAD »

Code: Select all

OpenWindow(0,200,200,200,200,"test",#PB_Window_SystemMenu)
  picker1=CreateWindowEx_(0,"SysDateTimePick32","",#WS_CHILD|#WS_VISIBLE|12+2,10,10,120,25,WindowID(0),0,GetModuleHandle_(0),0)
  ButtonGadget(0,10,160,60,24,"Get")
  ButtonGadget(1,80,160,60,24,"Set")
 
Repeat 
    Select WaitWindowEvent() 
        Case #PB_Event_CloseWindow 
            Quit = 1 
    
    
        Case #PB_Event_Gadget 
            Select EventGadget() 
                Case 0 
                    SendMessage_(picker1,#DTM_GETSYSTEMTIME,0,@d.SYSTEMTIME)
                    Debug "Date  : "+ Str(d\wDay)+" - "+ Str(d\wMonth) + " - " + Str(d\wYear)
                    Debug "Time  : "+ Str(d\wHour) + " - " + Str(d\wMinute) + " - "+ Str(d\wSecond)
                    
                Case 1
                    d\wDay = 10
                    d\wMonth = 2
                    d\wYear = 2010
                    ;d\wHour =
                    ;d\wMinute =
                    ;d\wSecond =
                    SendMessage_(picker1,#DTM_SETSYSTEMTIME,0,@d.SYSTEMTIME)

            EndSelect
    EndSelect 
Until Quit = 1

Egypt my love
Jumbuck
User
User
Posts: 63
Joined: Mon Nov 03, 2008 8:30 am
Location: Australia

Re: A Replacement For DateGadget

Post by Jumbuck »

Thanks Rashad.
Post Reply