ShadowElf Posted November 20, 2009 Share Posted November 20, 2009 I want to detect a focus lost event. pls help #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) $Form1 = GUICreate("Form1", 258, 155, 238, 143) $Combo1 = GUICtrlCreateCombo("Combo1", 24, 16, 217, 25) !!!oneventfocuslost(call loss() function)!!! $Input1 = GUICtrlCreateInput("Input1", 24, 48, 217, 21) GUISetState(@SW_SHOW) Func loss() MsgBox(-1, "test", "test") EndFunc While 1 Sleep(100) WEnd I like IT: php, mysql, codeingiter, css, jquery and AUTOIT Link to comment Share on other sites More sharing options...
funkey Posted November 20, 2009 Share Posted November 20, 2009 Maybe that way!? I don't know the variable-names Opt("GUIOnEventMode", 1) $Form1 = GUICreate("Form1", 258, 155, 238, 143) GUISetOnEvent(-3, "_Exit") GUIRegisterMsg(0x0111, "_LostFocus") ;$WM_KILLFOCUS Global $Combo1 = GUICtrlCreateCombo("Combo1", 24, 16, 217, 25) Global $Input1 = GUICtrlCreateInput("Input1", 24, 48, 217, 21) GUISetState(@SW_SHOW) While 1 Sleep(100000) WEnd Func _Exit() Exit EndFunc Func _LostFocus($hWnd, $Msg, $wParam, $lParam) $nNotifyCode = BitShift($wParam, 16) $nID = BitAND($wParam, 0x0000FFFF) If $nID = $Combo1 And $nNotifyCode = 10 Then MsgBox(0, "Info", "ComboBox1 lost focus!") If $nID = $Input1 And $nNotifyCode = 512 Then MsgBox(0, "Info", "Input1 lost focus!") EndFunc Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
ShadowElf Posted November 20, 2009 Author Share Posted November 20, 2009 thx, but why $nNotifyCode = 10 and $nNotifyCode = 512 if I have 10 inputs, how can I know what is the value of $nNotifyCode ? I like IT: php, mysql, codeingiter, css, jquery and AUTOIT Link to comment Share on other sites More sharing options...
funkey Posted November 20, 2009 Share Posted November 20, 2009 I don't know why, but I tested it. I even don't know why there is a difference between Input and Combo!? But it works. Opt("GUIOnEventMode", 1) $Form1 = GUICreate("Form1", 258, 300) GUISetOnEvent(-3, "_Exit") GUIRegisterMsg(0x0111, "_LostFocus") ;$WM_KILLFOCUS Global $aInput[10] For $i = 0 To 9 $aInput[$i] = GUICtrlCreateInput("Input_"&$i , 20, 20 + $i* 22, 217, 21) Next GUISetState(@SW_SHOW) While 1 Sleep(100000) WEnd Func _Exit() Exit EndFunc Func _LostFocus($hWnd, $Msg, $wParam, $lParam) $nNotifyCode = BitShift($wParam, 16) $nID = BitAND($wParam, 0x0000FFFF) If $nNotifyCode = 512 Then For $j = 0 To 9 If $nID = $aInput[$j] Then MsgBox(0, "Info", "Input" & $j & " lost focus!") Next EndIf EndFunc Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
ShadowElf Posted November 20, 2009 Author Share Posted November 20, 2009 and you know any other values for $nNotifyCode ? for example buttons, list, etc? I like IT: php, mysql, codeingiter, css, jquery and AUTOIT 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