#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
Global $Ctrl_Focus
Opt("GUIOnEventMode", 1)
$Form1 = GUICreate("Form1", 361, 161, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "Program_Exit")
$Input1 = GUICtrlCreateInput("Input1", 72, 40, 121, 21)
$Button1 = GUICtrlCreateButton("Button1", 232, 40, 75, 25)
$Input2 = GUICtrlCreateInput("Input2", 72, 88, 121, 21)
$Button2 = GUICtrlCreateButton("Button2", 232, 88, 75, 25)
$Dummy = GUICtrlCreateDummy()
GUICtrlSetOnEvent($Dummy, "Dummy_ENTER")
Local $HotKeys[2][2] = [["{Enter}", $Dummy],["{TAB}", $Dummy]]
GUISetAccelerators($HotKeys, $Form1)
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
Sleep(10)
WEnd
Func Program_Exit()
Exit
EndFunc
;###########################################
Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg
Local $hWndFrom, $iIDFrom, $iCode
$hWndFrom = $ilParam
$iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word
$iCode = BitShift($iwParam, 16) ; Hi Word
Switch $iIDFrom
Case $Input1
Switch $iCode
Case $GUI_FOCUS
Global $Ctrl_Focus = $Input1
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $Ctrl_Focus = ' & $Ctrl_Focus & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
EndSwitch
Case $Input2
Switch $iCode
Case $GUI_FOCUS
Global $Ctrl_Focus = $Input2
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $Ctrl_Focus = ' & $Ctrl_Focus & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_COMMAND
;###########################################
Func Dummy_ENTER()
Switch $Ctrl_Focus
Case $Input1
MsgBox(262144, 'Debug line ~' & @ScriptLineNumber, 'Selection:' & @LF & '$Input1' & @LF & @LF & 'Return:' & @LF & $Input1 & @LF & @LF & '@Error:' & @LF & @error) ;### Debug MSGBOX
Case $Input2
MsgBox(262144, 'Debug line ~' & @ScriptLineNumber, 'Selection:' & @LF & '$Input2' & @LF & @LF & 'Return:' & @LF & $Input2 & @LF & @LF & '@Error:' & @LF & @error) ;### Debug MSGBOX
EndSwitch
EndFunc ;==>Dummy_ENTER
;###########################################
|