Jump to content

Recommended Posts

Posted

Hi,

Implementing search functionality using AutoIt GUI. I am trying to capture/Trap Enter key Event in input field.

$textsearch = GUICtrlCreateInput("",50, 150,320,20)

Local $eventinfo[5]

$eventinfo = GUIGetMsg(1)

While 1

If $eventinfo[0] = $textsearch Then ;; trying to capture Enter key pressed by user in input box.

;; call something here

End

$eventinfo = GUIGetMsg(1)

WEnd

I am using the above which is not working in all cases to capture Enter key.

Please put some light on this.

Posted

Hi,

Implementing search functionality using AutoIt GUI. I am trying to capture/Trap Enter key Event in input field.

$textsearch = GUICtrlCreateInput("",50, 150,320,20)

Local $eventinfo[5]

$eventinfo = GUIGetMsg(1)

While 1

If $eventinfo[0] = $textsearch Then ;; trying to capture Enter key pressed by user in input box.

;; call something here

End

$eventinfo = GUIGetMsg(1)

WEnd

I am using the above which is not working in all cases to capture Enter key.

Please put some light on this.

First, please post working demos that don't force people to write code for you just to see your issue.

Second, it is the normal workings of a Windows API Input control to only fire an event on Enter IF THE CONTENT HAS CHANGED. Try this (note: running) demo:

Local $eventinfo[5]
$hGui = GuiCreate("Test", 420, 200)
$textsearch = GUICtrlCreateInput("", 50, 150, 320, 20)
GUISetState()

While 1
    $eventinfo = GUIGetMsg(1)
    Switch $eventinfo[0] 
        Case $textsearch 
            MsgBox(64, "Enter", "Enter")
        Case -3
            Exit
    EndSwitch
WEnd

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Posted

Hi PsaltyDS,

Thanks for your inputs. May be i am not clear in explain the issue here. From next time i will try to add complete code for function.

code i have also working in case of content changed in text box.

Is there any alternate mechanism to read Enter key always, I mean not in case of Content changed on text box it should always recoganise/capture Enter Event in Input field.

Please ignore if ask wrong question.

Thanks

sainumpudi

Posted

Hi PsaltyDS,

Thanks for your inputs. May be i am not clear in explain the issue here. From next time i will try to add complete code for function.

code i have also working in case of content changed in text box.

Is there any alternate mechanism to read Enter key always, I mean not in case of Content changed on text box it should always recoganise/capture Enter Event in Input field.

Please ignore if ask wrong question.

Thanks

sainumpudi

I guess you could test that the input has focus and then assign a HotKeySet() or use _IsPressed() on the ENTER.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...