rudi Posted October 20 Share Posted October 20 Hello, due to the help file on GUICtrlCreateDate() there seems no direct possibility to preset a range of SELECTABLE dates, like it is pretty common e.g. in online booking web pages: There the dates no more available are greyed out and cannot be selected. So my approach would be to check after user date selection, and in case the date should not be selectable, bring up some message "... is not available." It would be much more intuitive for the user to "gray out" all dates, then to turn available dates to "normal" (selectable), so that just available dates will be selectable. (background: A set of log files, the range / set of available dates isn't reliable predictable: Can be longer to the past, of course never in the future, and not every day must have a LOG file) TIA, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
Nine Posted October 20 Share Posted October 20 I think your best and easiest solution would be to create your own date picker. You could use mine (see signature) as a starting point. “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...
rudi Posted October 21 Author Share Posted October 21 @Nine thanks for pointing out your IDF Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
MattyD Posted October 21 Share Posted October 21 (edited) Also if its useful (Nine's solution may be better!) - it seems you can use the MCS_MULTISELECT style with a "Month Calendar Control". I'm not entirely sure which notification GuiGetMessage looks for (presumably MCN_SELCHANGE - I'd need more of a play) - But if GGM is trigger happy, you can always handle WM_NOTIFY and look for MCN_SELCHANGE messages . Edit - Ahh sorry misread the original question. It looks like you may be able to make dates bold with this control, but probably not greyed out. #include <guiconstants.au3> $hGUI = GUICreate("", 404, 404) $hCal = GUICtrlCreateMonthCal("", 4, 4, 250, 200, $MCS_MULTISELECT) Local $tagSYSTEMTIME = "align 2; word Year; word Month; word DayOfWeek; " & _ "word Day; word Hour; word Minute; word Second; word Milliseconds;" Local $tTimeSel = DllStructCreate("word StartSel[8];word EndSel[8]") Local $pTimeSel = DllStructGetPtr($tTimeSel) Local $tSysTime GUISetState() While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE Exit Case $hCal GUICtrlSendMsg($hCal, $MCM_GETSELRANGE, 0, $pTimeSel) $tSysTime = DllStructCreate($tagSYSTEMTIME, $pTimeSel) ConsoleWrite(StringFormat("StartSel - Day: %s Month: %s Year: %s", $tSysTime.Day, $tSysTime.Month, $tSysTime.Year) & @CRLF) $tSysTime = DllStructCreate($tagSYSTEMTIME, Ptr($pTimeSel + 16)) ConsoleWrite(StringFormat("EndSel - Day: %s Month: %s Year: %s", $tSysTime.Day, $tSysTime.Month, $tSysTime.Year) & @CRLF) EndSwitch WEnd Edited October 21 by MattyD Link to comment Share on other sites More sharing options...
MattyD Posted October 21 Share Posted October 21 OK FWIW it seems setting limits is possible after all... expandcollapse popup#include <guiconstants.au3> $hGUI = GUICreate("", 400, 400) $hCal = GUICtrlCreateMonthCal("", -1,-1,-1,-1, BitOR($MCS_MULTISELECT, $MCS_NOTODAY, $MCS_NOTODAYCIRCLE)) Local $tagSYSTEMTIME = "align 2; word Year; word Month; word DayOfWeek; " & _ "word Day; word Hour; word Minute; word Second; word Milliseconds;" Local $tTimeSel = DllStructCreate("word StartSel[8];word EndSel[8]") Local $pTimeSel = DllStructGetPtr($tTimeSel) Local $tSysTime GUISetState() ;;;Set Selectable Range ;;;; ;Selectable Start Date - 1st of previous Month $tSysTime = DllStructCreate($tagSYSTEMTIME, $pTimeSel) $tSysTime.Day = 1 $tSysTime.Month = Mod(@MON - 1, 12) $tSysTime.Year = @YEAR ;Selectable End Date - 1st of next Month $tSysTime = DllStructCreate($tagSYSTEMTIME, Ptr($pTimeSel + 16)) $tSysTime.Day = 1 $tSysTime.Month = Mod(@MON + 1, 12) $tSysTime.Year = @YEAR GUICtrlSendMsg($hCal, $MCM_SETRANGE, BitOR($GDTR_MIN, $GDTR_MAX), $pTimeSel) ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Set Max selectable days GUICtrlSendMsg($hCal, $MCM_SETMAXSELCOUNT, 10, 0) While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE Exit Case $hCal GUICtrlSendMsg($hCal, $MCM_GETSELRANGE, 0, $pTimeSel) $tSysTime = DllStructCreate($tagSYSTEMTIME, $pTimeSel) ConsoleWrite(StringFormat("StartSel - Day: %s Month: %s Year: %s", $tSysTime.Day, $tSysTime.Month, $tSysTime.Year) & @CRLF) $tSysTime = DllStructCreate($tagSYSTEMTIME, Ptr($pTimeSel + 16)) ConsoleWrite(StringFormat("EndSel - Day: %s Month: %s Year: %s", $tSysTime.Day, $tSysTime.Month, $tSysTime.Year) & @CRLF) EndSwitch WEnd Link to comment Share on other sites More sharing options...
rudi Posted October 21 Author Share Posted October 21 Thanks @MattyD I'll take a closer look to your approach as well. MattyD 1 Earth is flat, pigs can fly, and Nuclear Power is SAFE! 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