Armand Posted March 17, 2008 Share Posted March 17, 2008 expandcollapse popup#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GuiConstantsEx.au3> #include <GuiDateTimePicker.au3> Opt('MustDeclareVars', 1) $Debug_DTP = False ; Check ClassName being passed to DTP functions, set to True and use a handle to another control to see it work Global $iMemo, $tDate _Main() Func _Main() Local $hDTP ; Create GUI GUICreate("DateTimePick Set System TimeEx", 400, 300) $hDTP = GUICtrlGetHandle(GUICtrlCreateDate("", 2, 6, 190)) $iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0) GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New") GUISetState() ; Set the display format ;_GUICtrlDTP_SetFormat($hDTP, "ddd MMM dd, yyyy hh:mm ttt") ; Set system time $tDate = DllStructCreate($tagDTPTIME) DllStructSetData($tDate, "Year", @YEAR) DllStructSetData($tDate, "Month", 8) DllStructSetData($tDate, "Day", 19) DllStructSetData($tDate, "Hour", 21) DllStructSetData($tDate, "Minute", 57) DllStructSetData($tDate, "Second", 34) _GUICtrlDTP_SetSystemTimeEx($hDTP, $tDate, True) ; Display system time $tDate = _GUICtrlDTP_GetSystemTimeEx($hDTP) MemoWrite("Current date: " & GetDateStr()) MemoWrite("Current time: " & GetTimeStr()) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main ; Returns the date portion Func GetDateStr() Return StringFormat("%02d/%02d/%04d", DllStructGetData($tDate, "Month"), DllStructGetData($tDate, "Day"), DllStructGetData($tDate, "Year")) EndFunc ;==>GetDateStr ; Returns the time portion Func GetTimeStr() Return StringFormat("%02d:%02d:%02d", DllStructGetData($tDate, "Hour"), DllStructGetData($tDate, "Minute"), DllStructGetData($tDate, "Second")) EndFunc ;==>GetTimeStr ; Write a line to the memo control Func MemoWrite($sMessage) GUICtrlSetData($iMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite This code taken from the help .chm file. > only thing changed is this line: "_GUICtrlDTP_SetSystemTimeEx($hDTP, $tDate, True)" and the fact i've commented the ";_GUICtrlDTP_SetFormat($hDTP, "ddd MMM dd, yyyy hh:mm ttt")"... if you'll check that code you'll find that the DTP isn't set to "no date" but it is set to todays time... P.S-> is there any suggestion on how to make it blank ?! [u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?! Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 17, 2008 Share Posted March 17, 2008 I have seen Gary recommend against creating controls with the native functions, getting the handle, and then manipulating with the UDF functions. Switch the control creation to the UDF version makes it do what I think you are seeking: expandcollapse popup#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GuiConstantsEx.au3> #include <GuiDateTimePicker.au3> Opt('MustDeclareVars', 1) $Debug_DTP = False ; Check ClassName being passed to DTP functions, set to True and use a handle to another control to see it work Global $iMemo, $tDate, $hGUI _Main() Func _Main() Local $hDTP ; Create GUI $hGUI = GUICreate("DateTimePick Set System TimeEx", 400, 300) $hDTP = _GUICtrlDTP_Create($hGUI, 10, 10, 250, 30, BitOR($DTS_SHOWNONE, $DTS_TIMEFORMAT)) $iMemo = GUICtrlCreateEdit("", 10, 40, 380, 240, 0) GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New") GUISetState() ; Set the display format _GUICtrlDTP_SetFormat($hDTP, "ddd MMM dd, yyyy hh:mm ttt") ; Set system time $tDate = DllStructCreate($tagDTPTIME) DllStructSetData($tDate, "Year", @YEAR) DllStructSetData($tDate, "Month", 8) DllStructSetData($tDate, "Day", 19) DllStructSetData($tDate, "Hour", 21) DllStructSetData($tDate, "Minute", 57) DllStructSetData($tDate, "Second", 34) _GUICtrlDTP_SetSystemTimeEx($hDTP, $tDate, True) ; Display system time $tDate = _GUICtrlDTP_GetSystemTimeEx($hDTP) MemoWrite("Current date: " & GetDateStr()) MemoWrite("Current time: " & GetTimeStr()) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main ; Returns the date portion Func GetDateStr() Return StringFormat("%02d/%02d/%04d", DllStructGetData($tDate, "Month"), DllStructGetData($tDate, "Day"), DllStructGetData($tDate, "Year")) EndFunc ;==>GetDateStr ; Returns the time portion Func GetTimeStr() Return StringFormat("%02d:%02d:%02d", DllStructGetData($tDate, "Hour"), DllStructGetData($tDate, "Minute"), DllStructGetData($tDate, "Second")) EndFunc ;==>GetTimeStr ; Write a line to the memo control Func MemoWrite($sMessage) GUICtrlSetData($iMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Armand Posted March 17, 2008 Author Share Posted March 17, 2008 ummzz... thanks a lot for the tip, however it had nothing to do with the function creating the DTP control but to the style "$DTS_SHOWNONE" i didn't knew as a part of the process.... i mean, i saw it before but i was hoping there is some way to leave it as is without any checkbox shoved inside and yet displaying an emptied Input for the DTP...Anyhow - THANKS A LOT FOR THE HELP !!! [u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now