Sign in to follow this  
Followers 0
joshiieeii

Enter key activates Case?

4 posts in this topic

#1 ·  Posted (edited)

Ok guys, wish I could post the actual script, but it is rather huge and would only confuse you more. Basically, I have a case that I would like to be able to activate by hitting the enter key. The case in question is a gui button and is literally a next button before an input box. So I am inputting text and would like to be able to hit Enter to click next vs actually clicking next.

I have tried searching...no luck...I tried a Hotkey, but the case is not a function. I tried taking the code out of the while loop and make it a function so I could use the Enter key (by the way it worked), but then the rest of the loop does not function correctly. Any help would be much appreciated.

This is just a crude example of the situation I have.

#include <GUIConstants.au3>
Dim $window
Dim $test
Dim $input


$window = GUICreate("Test", 200, 200, 50, 50)
GUICtrlCreateLabel ( "Input:",5, 50, 80, 20)
$input = GUICtrlCreateInput ( "", 50, 50, 50, 20)
$test = GUICtrlCreateButton ("Next>>", 150,50,50)
GUISetState () 
While 1
$msg = GUIGetMsg()
Select
case $msg = $test
Msgbox(0,"","Test Works")
Case $msg = $GUI_EVENT_CLOSE
Exit
EndSelect
WEnd
Edited by joshiieeii

Share this post


Link to post
Share on other sites



Is this what you mean:

#include <GUIConstants.au3>
Dim $window
Dim $test
Dim $input


$window = GUICreate("Test", 200, 200, 50, 50)
GUICtrlCreateLabel("Input:", 5, 50, 80, 20)
$input = GUICtrlCreateInput("", 50, 50, 50, 20)
$test = GUICtrlCreateButton("Next>>", 150, 50, 50, 30, BitOR($GUI_SS_DEFAULT_BUTTON, $BS_DEFPUSHBUTTON))
GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $test
            MsgBox(0, "", "Test Works")
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd

Alzo


Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Share this post


Link to post
Share on other sites

Is this what you mean:

#include <GUIConstants.au3>
Dim $window
Dim $test
Dim $input
$window = GUICreate("Test", 200, 200, 50, 50)
GUICtrlCreateLabel("Input:", 5, 50, 80, 20)
$input = GUICtrlCreateInput("", 50, 50, 50, 20)
$test = GUICtrlCreateButton("Next>>", 150, 50, 50, 30, BitOR($GUI_SS_DEFAULT_BUTTON, $BS_DEFPUSHBUTTON))
GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $test
            MsgBox(0, "", "Test Works")
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd

Alzo

Thats exactly what I was looking for, Thank you very much, you are truly 'da man' :D

Share this post


Link to post
Share on other sites

YWC


Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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