Jump to content
Sign in to follow this  
SURI

Problems with DTP control

Recommended Posts

SURI

Hi

I would like to use both keyboard and mouse in DTP control.
However, if I enter only 4 characters(year part), it moves to the next control
(Month and day can not be entered.)
Please take a look at my script.
 What's the problem?

#include <WindowsConstants.au3>
#include <Date.au3>
#include <GUIConstantsEx.au3>

Global $MainGui = GUICreate("", 400, 400, -1, -1)
Global $date1 = GUICtrlCreateDate(_Now(), 89, 120, 110, 24, 0)
$ipt1 = GUICtrlCreateInput("", 89, 148, 73, 24)
Global $date2 = GUICtrlCreateDate(_Now(), 89, 190, 110, 24, 0)
$ipt2 = GUICtrlCreateInput("", 89, 228, 73, 24)
GUISetState()

Global $Enter_KEY = GUICtrlCreateDummy()
Local $Arr[1][2] =[["{ENTER}", $Enter_KEY]]
GUISetAccelerators($Arr)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")


While 1
    $Msg = GUIGetMsg(1)
        Switch $Msg[0]
            Case $GUI_EVENT_CLOSE
                GUIDelete($MainGui)
                Exit
            Case $Enter_KEY
                Switch  _WinAPI_GetFocus()
                    Case GUICtrlGetHandle($date1)
                        Send("^{Tab}")
                    Case GUICtrlGetHandle($date2)
                        Send("^{Tab}")
                    Case GUICtrlGetHandle($ipt1)
                        Send("^{Tab}")
                    Case GUICtrlGetHandle($ipt2)
                        Send("^{Tab}")
                EndSwitch
        EndSwitch
WEnd

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $iIDFrom
        Case $date1
            Switch $iCode
                Case $DTN_DATETIMECHANGE
                        Send("^{Tab}")
            EndSwitch
        Case $date2
            Switch $iCode
                Case $DTN_DATETIMECHANGE
                        Send("^{Tab}")
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

 

Share this post


Link to post
Share on other sites
Bowmore

It's moving to the next control because that is what you are telling it to do with these lines

Case $DTN_DATETIMECHANGE
                         Send("^{Tab}")

in the WM_NOTIFY function


"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Share this post


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
Sign in to follow this  

×