Sign in to follow this  
Followers 0
smahdi83

Alert when Control loses FOCUS

3 posts in this topic

#1 ·  Posted (edited)

Hi,

How can I check if a certain textbox lost focus? Please this is really important and I have no clue on how to do that?

Thanks,

Edited by smahdi83

Share this post


Link to post
Share on other sites



Is there any way in Autoit to trigger an event as soon as a textbox loses focus? I can't seem to find anything to help me do that.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi,

How can I check if a certain textbox lost focus? Please this is really important and I have no clue on how to do that?

Thanks,

You could do it like this (assuming a textbox is an edit)-

#INCLUDE <GUICONSTANTS.AU3>
#include <constants.au3>
Global Const $WM_COMMAND = 0x0111
Global Const $EN_KILLFOCUS = 0x0200

$w1 = GUICreate('edit lost focus')

$edit1 = GUICtrlCreateEdit("some text", 20, 20, 120, 80)
$edit2 = GUICtrlCreateEdit("some text", 20, 120, 120, 80)
GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")
GUISetState()

While GUIGetMsg() <> -3
WEnd


Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam)
    Local $nNotifyCode = BitShift($wParam, 16)
    Local $nID = BitAND($wParam, 0xFFFF)
    Local $hCtrl = $lParam

    Switch $nID
        Case $edit1
            Switch $nNotifyCode
                Case $EN_KILLFOCUS
                    MsgBox(0, 'EDIT LOST FOCUS', 'from Edit1')
            EndSwitch
    EndSwitch

    Return $GUI_RUNDEFMSG
EndFunc ;==>MY_WM_COMMAND

It's actually easy to find the notifications and messages for a control.

Have a look here.]

EDIT: Added link to msdn

Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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  
Followers 0