Claian Posted June 17, 2008 Share Posted June 17, 2008 hey guys, i've been trying to figure this out for a while now and i cant seem to find the info i need despite countless attempts to seach the forums, i'm using a date control to set the date my program generates data from, i have that bit working without any errors, i then have a second date control that automatically is set to 7 days after the first control using _DateAdd when the form loads. This is because i normally want to work on a weeks worth of data at a time, i cant just remove the second control as sometimes we need data from a certain date range that could be larger or smaller than the normal 7 days This second date control is normally not editable unless the user clicks a checkbox to use custom date ranges. The problem i'm having is getting the second control to update after i change the date in the first control. So far i've tried getting it work with both MessageLoop mode and OnEvent mode. I can get the buttons, the checkboxes and the reports to generate fine using both, i cant however get the second date control to recognise that the first has changed. I dont have the code with me atm, the dev machine is being used by some else. Does anyone have any info on how i can get the program to notice a date control has been changed? Or at the least an online resource that can show me what i'm doing wrong Thanks in advance if you can help me out, this has been driving me nuts Link to comment Share on other sites More sharing options...
nobbe Posted June 17, 2008 Share Posted June 17, 2008 (edited) you would need to add a custom WM_NOTIFY to your code to get the information when your control changes similar to (i dont have the codes for the date control) GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events") ; WM_NOTIFY event handler Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam Local $tagNMHDR, $event, $hwndFrom, $code $tagNMHDR = DllStructCreate("int;int;int", $lParam);NMHDR (hwndFrom, idFrom, code) If @error Then Return $event = DllStructGetData($tagNMHDR, 3) Select Case $wParam = $listview_results Select Case $event = $NM_CLICK ; ListView_Click () Case $event = $NM_DBLCLK ListView_DoubleClick() EndSelect EndSelect $tagNMHDR = 0 $event = 0 $lParam = 0 EndFunc ;==>WM_Notify_Events Edited June 17, 2008 by nobbe Link to comment Share on other sites More sharing options...
ResNullius Posted June 17, 2008 Share Posted June 17, 2008 This works for me using plain old OnEvent mode (will also work with GuiGetMsg mode) #include <DateTimeConstants.au3> #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) $Gui = GUICreate("test");, 633, 447, 193, 125) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $dtDateFrom = GUICtrlCreateDate("", 64, 80, 186, 21) GuiCtrlSetOnEvent(-1,"EVENT_dtDateFrom") $dtDateTo = GUICtrlCreateDate("", 64, 120, 186, 21) GUISetState(@SW_SHOW) While 1 Sleep(10) WEnd Func EVENT_dtDateFrom() MsgBox(0, "", "Date 1 EVENT") EndFunc Func _Exit() Exit EndFunc Link to comment Share on other sites More sharing options...
Claian Posted June 18, 2008 Author Share Posted June 18, 2008 OH, thanks so much ResNullius, i cant belive how stupid i feel right now, i think i was blind to the error because i thought it should be working, i accidently had GUISetOnEvent instead of GUICtrlSetOnEvent. Now it works perfectly thanks 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