Jump to content

Recommended Posts

I have been trying to figure out a way to make a box in an autoit gui that can capture both date and time. I tried using both of these:

$idStart = GUICtrlCreateDate("2015/07/03 12:13:3", 72, 15, 186, 21, $DTS_SHORTDATEFORMAT)
    $idStart = GUICtrlCreateDate("2015/07/03 12:13:3", 72, 15, 186, 21, $DTS_TIMEFORMAT)

When I tried a BItOR on the two styles, I was hoping that it would display both, but unfortunately it doesn't. Short of creating two GuiCtrls (one for date and one for time) is there a way to do this as a single box?

Edited by Jewtus
Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Simpel
      Hi, I created a gui with date field but formatted as time in HH:mm. It always shows "now-time". Even if I try to set it with GUICtrlSetData.
      #include <DateTimeConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Example() Func Example() GUICreate("My GUI get date", 200, 200, 800, 200) Local $idDate = GUICtrlCreateDate("", 20, 20, 100, 20, $DTS_TIMEFORMAT) ; to select a specific default format Local $sStyle = "HH:mm" ; Just display hours and minutes <<<<<<<<<<<<<<<<<<<<<<<<<<<< GUICtrlSendMsg($idDate, $DTM_SETFORMATW, 0, $sStyle) ConsoleWrite(GUICtrlRead($idDate) & @CRLF) GUICtrlSetData($idDate, "00:00") ConsoleWrite(GUICtrlRead($idDate) & @CRLF) GUISetState(@SW_SHOW) ; Loop until the user exits. While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd MsgBox($MB_SYSTEMMODAL, "Time", GUICtrlRead($idDate)) EndFunc ;==>Example How can I set the time field with another time and how can this field be set blank?
      Regards, Conrad
    • By SupaNewb
      Issue: If either date picker controls receive focus, then use arrow keys to change date in edit portion, flags do not set to True until mouse move or mouse click.
      I have used this exact method in the past & it works perfectly. I just can't figure out what I am doing wrong here. The only thing different I can think of is I just updated my Autoit version to ;Autoit v3.3.14.0 & if it matters system I am using is running Win7 Pro x86.
      #include <WindowsConstants.au3> #include <GuiRichEdit.au3> #include <Date.au3> #include <DateTimeConstants.au3> #include <GUIConstantsEx.au3> ;If either date picker controls recieve focus, then use arrow keys to change date ; in edit portion, flags do not set to True until mouse move or mouse click. ;Flags set fine when drop down is closed Global $fdpLogChange = False, $fdpMainChange = False Global $hDailyLogGUI, $g_id_dpDailyLog Global $hMainGui = GUICreate("GardenBuddy", @DesktopWidth / 1.5, @DesktopHeight / 1.4, -1, -1) Global $g_id_dpMain = GUICtrlCreateDate(_NowDate(), 8, 20, 181, 25) Global $mView = GUICtrlCreateMenu("&View") Global $mPlantChart = GUICtrlCreateMenuItem("Plant Chart", $mView, 0) GUICtrlCreateMenuItem("", $mView, 1) Global $mDailyLog = GUICtrlCreateMenuItem("Daily Log", $mView, 2) GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") While 1 $Msg = GUIGetMsg(1) Switch $Msg[1] Case $hMainGui Switch $Msg[0] Case $GUI_EVENT_CLOSE GUIDelete($hMainGui) Exit Case $mDailyLog __CreateDailyLog() Case Else If $fdpMainChange = True Then __DateChangeMain() EndSwitch Case $hDailyLogGUI Switch $Msg[0] Case $GUI_EVENT_CLOSE GUIDelete($hDailyLogGUI) Case Else If $fdpLogChange = True Then __DateChangeDL() EndSwitch EndSwitch WEnd Func __CreateDailyLog() Local $iW = @DesktopWidth / 2, $iH = @DesktopHeight / 2 $hDailyLogGUI = GUICreate("Daily Log", $iW, $iH, -1, -1, $WS_OVERLAPPEDWINDOW) $g_reDailyLog = _GUICtrlRichEdit_Create($hDailyLogGUI, "", 0, 60, $iW, $iH - 110, _ BitOR($WS_VSCROLL, $ES_WANTRETURN, $ES_AUTOVSCROLL, $ES_MULTILINE)) _GUICtrlRichEdit_SetFont($g_reDailyLog, 12) $g_id_dpDailyLog = GUICtrlCreateDate(_NowDate(), 8, 20, 181, 25) GUISetState() EndFunc ;==>__CreateDailyLog Func __DateChangeDL();Would like to be instantly notified if user changes the date through any means. $fdpLogChange = False ConsoleWrite("Log Changed" & @CRLF) EndFunc ;==>__DateChangeDL Func __DateChangeMain() $fdpMainChange = False ConsoleWrite("Main Changed" & @CRLF) EndFunc ;==>__DateChangeMain Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tInfo, $hWndDateDailyLog, $hWndDateMain $hWndDateDailyLog = GUICtrlGetHandle($g_id_dpDailyLog) $hWndDateMain = GUICtrlGetHandle($g_id_dpMain) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndDateDailyLog, $hWndDateMain Switch $iCode Case $DTN_DATETIMECHANGE If $iIDFrom = $g_id_dpDailyLog Then $fdpLogChange = True If $iIDFrom = $g_id_dpMain Then $fdpMainChange = True Return 0 Case $DTN_CLOSEUP ;no return value Case $DTN_USERSTRING Return 0 Case $DTN_WMKEYDOWN Return 0 EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY 
    • By javiwhite
      Hi All,
      I've run into an issue in one of my scripts using the GUICtrlCreateDate function with the $DTS_TIMEFORMAT flag.
      Basically, after the creation of the Date tool, I seem to be unable to set the data in the box; And after reading the function reference for GuiCtrlSetData, This does seem to be something that's supported... So i'm a little lost as to where exactly i'm going wrong.
      I've created a quick test script, and still can't get the two functions to work harmoniously:
      local $GUI = GuiCreate("",100,40) local $testDate = GUICtrlCreateDate("",15,10,70,20,9,-1) local $test = GUIctrlSetData(-1,"09:00:00") ConsoleWrite($test & @CR) GUIsetState(@SW_SHOW) While 1 switch GUIgetMsg() Case -3 Exit EndSwitch WEnd  Theoretically, the date input should show 09:00:00, But the GUIctrlSetData seems to be failing (returning 0).
      I've checked the format of the Date input by using GUIctrlRead, and have adhered to that format in the test above, but it still seems to be failing.
      Any Ideas? Any help is greatly appreciated!
      Many Thanks

    • By Jewtus
      If you use the command
      GUICtrlCreateDate("",89, 280, 201, 21) it creates a date box and defaults to today's date. Is there a way to make it so the default value is actually blank? I've already tried putting in Null, default, 0, and "0" but it doesn't seem to blank out the date.
      I did find this:
      GUICtrlCreateDate("",89, 280, 201, 21, 0x02) will create a checkbox inside the date that can be unselected to blank out the box, but I want the box to be default disabled unless a date is selected.
      Any ideas?
    • By argumentum
      I'd really like to change the background color of a Date control
      and GUICtrlSetBkColor does not do it, help 

      #include <DateTimeConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 167, 99, 192, 114) $Input1 = GUICtrlCreateInput("Input1", 16, 16, 121, 21) GUICtrlSetBkColor(-1, 0xFF0000) $Date1 = GUICtrlCreateDate("", 16, 48, 122, 21, 0) GUICtrlSetBkColor(-1, 0xFF0000) ; <-- not working GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ###   While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd
  • Create New...