Jump to content
Sign in to follow this  
nht3004

Which function shows us when the Input lost focus?

Recommended Posts

nht3004

It is like <input type="text" onfocus="" onblur="">.

Could anyone help me plz, show me the way to do that using AutoIt with GUICtrlCreateInput!


for(loop=0; loop<infinity; loop++) { alert('I love you'); }

Share this post


Link to post
Share on other sites
Yashied

Share this post


Link to post
Share on other sites
nht3004

_WinAPI_GetFocus()

I meant the focus of the Input bro ^^

for(loop=0; loop<infinity; loop++) { alert('I love you'); }

Share this post


Link to post
Share on other sites
BrettF

Mate its a good suggestion. You haven't provided any example code (in AutoIt)...

Something like this could be adapted to your needs.

$old_focus = ""
$GUI = GUICreate ("Test", 200, 150)
$hInput = GUICtrlCreateInput ("Input 1", 10, 10, 130)
$hInput2 = GUICtrlCreateInput ("Input 2", 10, 35, 130)
$hInput3 = GUICtrlCreateInput ("Input 3", 10, 60, 130)
GUISetState ()

While 1
    $nMsg = GUIGetMsg ()
    Switch $nMsg
        Case -3
            Exit
    EndSwitch
    $focused_Control = ControlGetFocus($GUI)
    If $focused_Control <> $old_focus Then
        MsgBox (0, "",  "'" & ControlGetText ($GUI, "", $focused_Control) & "' gained focus" & @CRLF & _
                        "'" & ControlGetText ($GUI, "", $old_focus) & "' lost focus")
        $old_focus = $focused_Control
    EndIf
WEnd

But you can adapt it.

Cheers,

Brett

Share this post


Link to post
Share on other sites
nht3004

Mate its a good suggestion. You haven't provided any example code (in AutoIt)...

Something like this could be adapted to your needs.

$old_focus = ""
$GUI = GUICreate ("Test", 200, 150)
$hInput = GUICtrlCreateInput ("Input 1", 10, 10, 130)
$hInput2 = GUICtrlCreateInput ("Input 2", 10, 35, 130)
$hInput3 = GUICtrlCreateInput ("Input 3", 10, 60, 130)
GUISetState ()

While 1
    $nMsg = GUIGetMsg ()
    Switch $nMsg
        Case -3
            Exit
    EndSwitch
    $focused_Control = ControlGetFocus($GUI)
    If $focused_Control <> $old_focus Then
        MsgBox (0, "",  "'" & ControlGetText ($GUI, "", $focused_Control) & "' gained focus" & @CRLF & _
                        "'" & ControlGetText ($GUI, "", $old_focus) & "' lost focus")
        $old_focus = $focused_Control
    EndIf
WEnd

But you can adapt it.

Cheers,

Brett

It worked, thanks!

for(loop=0; loop<infinity; loop++) { alert('I love you'); }

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  

×