randym Posted August 26, 2021 Share Posted August 26, 2021 I have a user request to be able to optionally leave a date field blank or otherwise null it out ... Research led me to the $DTS_SHOWNONE style that looks promising ... I created a test script and implemented it, but perhaps I don't have the usage exactly right ... I get the checkbox that seems to enable and disable the field, but the contents remain the same .... Am I missing something? My test script is included below. TIA - Randy Date_Test.au3 And the sign said 'Long Hairded Creepy People Need Not Apply' ... So I stuffed my hair up under my hat and I went in to ask him why? Link to comment Share on other sites More sharing options...
Zedna Posted August 26, 2021 Share Posted August 26, 2021 (edited) For reading state of checkbox inside Date control (with DTS_SHOWNONE style) generally you have to use GUICtrlSendMsg($P_VPOREFDATE, $DTM_GETDATETIMEPICKERINFO, ...) And then read value of stateCheck in DATETIMEPICKERINFO structure ... This message and structure is not declared in standard AutoIt's include file <DateTimeConstants.au3> so you have to do it yourself. See here for official MSDN DOC: https://docs.microsoft.com/en-us/windows/win32/controls/dtm-getdatetimepickerinfo https://docs.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-datetimepickerinfo See here example for DTM_GETDATETIMEPICKERINFO message (in C) on stackoverflow: https://stackoverflow.com/questions/43576035/is-there-a-way-to-get-the-handle-of-the-entry-field-in-a-date-time-picker-dtp Edited August 26, 2021 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Solution Nine Posted August 26, 2021 Solution Share Posted August 26, 2021 Or you can use this : While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $P_VPOREFDATE _GUICtrlDTP_GetSystemTimeEx(GUICtrlGetHandle($P_VPOREFDATE)) $test_dt = @error = $GDT_NONE ? "" : GUICtrlRead($P_VPOREFDATE) ConsoleWrite("<" & $test_dt & ">" & @CRLF) EndSwitch WEnd Zedna 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
randym Posted August 26, 2021 Author Share Posted August 26, 2021 Thanks for the responses to this topic .... Nine - your suggestion works perfectly for me and fits well with my existing code. Again, thanks! And the sign said 'Long Hairded Creepy People Need Not Apply' ... So I stuffed my hair up under my hat and I went in to ask him why? 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