Jump to content

Recommended Posts

Posted

Hi,

How do you detect user press Enter key at the the end of the line and set action by content of it ?

I have my gui with GUICtrlCreateInput on it . So far it is working ok by user type in control and click the button , but I would like to set it so user type in , press Enter key at the end of that line . The script then detect that , read content of input control then process

dly

Posted

I just found it a way go around by set my button to default button with GUICtrlSetState(-1, $GUI_DEFBUTTON).

But just curious , if I have more than one edit control in GUI , how to find out which edit control user just type in , press Enter at the end ?

Posted

Try this:

#include <GUIConstantsEx.au3>

Example()

Func Example()
    Local $iInput, $iENTER, $msg

    GUICreate(" My GUI input acceptfile", 320, 120, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45)
    $iInput = GUICtrlCreateInput("", 10, 5, 300, 20)

    $iENTER = GUICtrlCreateDummy()
    Dim $AccelKeys[1][2] = [["{ENTER}", $iENTER]]; Set accelerators
    GUISetAccelerators($AccelKeys)

    GUISetState()

    $msg = 0
    While $msg <> $GUI_EVENT_CLOSE
        $msg = GUIGetMsg()
        Select
            Case $msg = $iENTER
                MsgBox(4096, "Test", "[Enter] key is detected!")
        EndSelect
    WEnd
EndFunc   ;==>Example

Regards,

João Carlos.

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

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...