@FireFox
I think about this but this is not what he need (I think so)
In your example you must change date, but i think, OP want to check date after changing focus
Maybe this:
#include <ButtonConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
Example()
Func Example()
Local $date, $msg
Local $date, $msg
Local $hGui = GUICreate("My GUI get date", 200, 200, 800, 200)
Local $idDate1 = GUICtrlCreateDate("1953/04/25", 10, 10, 185, 20)
Local $idDate2 = GUICtrlCreateDate("1953/04/25", 10, 50, 185, 20)
Local $button1 = GUICtrlCreateButton("Submit", 10, 100, 50, 50, -1, -1)
GUISetState(@SW_SHOW)
Local $idLastFocus = 0
; Local $idNewFocus = 0
; Loop until the user exits.
$idLastFocus = ControlGetFocus($hGui)
While 1
; ConsoleWrite('ControlGetFocus($hGui) = ' & ControlGetFocus($hGui) & @CRLF)
If $idLastFocus <> ControlGetFocus($hGui) Then
If $idLastFocus = 'SysDateTimePick321' Then
ConsoleWrite('Date1 = ' & GUICtrlRead($idDate1) & @CRLF)
EndIf
If $idLastFocus = 'SysDateTimePick322' Then
ConsoleWrite('Date2 = ' & GUICtrlRead($idDate2) & @CRLF)
EndIf
$idLastFocus = ControlGetFocus($hGui)
EndIf
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $idDate1
ConsoleWrite(GUICtrlRead($idDate1) & @CRLF)
Case $idDate2
ConsoleWrite(GUICtrlRead($idDate2) & @CRLF)
Case $button1
EndSwitch
WEnd
GUIDelete()
EndFunc ;==>Example
EDIT:
commented Local $idNewFocus = 0
because not needed