Jump to content

Pressing enter on edit box


 Share

Recommended Posts

#include <GUIConstants.au3>

$GUI = GUICreate("", 162, 96, -1, -1)
$Input = GUICtrlCreateInput("Type hello then hit enter!", 8, 8, 145, 21)
$Send = GUICtrlCreateButton("&Send", 32, 40, 89, 41, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Input
            If GuiCtrlRead($Input) = "Hello" Then
                MsgBox(4096, "Hello!", "You pressed the enter key!")
            EndIf
        Case $Send
            If GuiCtrlRead($Input) = "Hello" Then
                MsgBox(4096, "Hello!", "You pressed the send key!")
            EndIf
    EndSwitch
WEnd

That's a better example.

-James

Edited by NeoTroniX
Link to comment
Share on other sites

#include <GUIConstants.au3>

$GUI = GUICreate("", 161, 37, -1, -1)
$Input = GUICtrlCreateInput("Type hello then hit enter!", 8, 8, 145, 21)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Input
            If GuiCtrlRead($Input) = "Hello" Then
                MsgBox(4096, "Hello!", "You pressed the enter key!")
            EndIf
    EndSwitch
WEnd

Modified NeoTroniX's example. Is this more like what you want?

Link to comment
Share on other sites

This is more what I needed:

DUH!! to me, I found this in the FAQ sticky

HotKeySet("{ENTER}", "catchguikey")
;
;REST OF CODE HERE
;
;
Func catchguikey()
    Local $opt = Opt("WinTitleMatchMode", 4)
    If WinGetHandle("active") = $DB Then
        If @HotKeyPressed = "{ENTER}" Then
            ;Do something here
           _IENavigate($oIE, GUICtrlRead( $manualaddy ), 0)
        EndIf
    Else
        HotKeySet(@HotKeyPressed)
        Send(@HotKeyPressed)
        HotKeySet(@HotKeyPressed, "catchguikey")
    EndIf
    Opt("WinTitleMatchMode", $opt)
EndFunc
Link to comment
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
 Share

  • Recently Browsing   0 members

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