Sign in to follow this  
Followers 0
greggklein

Lost btn focus

2 posts in this topic

I just installed newest version of autoit and now my GUI does not work like it did.

What is the easiest way to have a button have focus but be able to type in an input and then only have to hit the enter key for it to submit

This is how I did it before and it worked perfectly until I downloaded current version

$txtUserAnswer = GUICtrlCreateInput("", 235, 200, 100, 20)

$btn = GUICtrlCreateButton("CHECK ANSWER", 125, 200, 100, 20)

GUICtrlSetState($btn, $GUI_FOCUS)

Send(@TAB)

Share this post


Link to post
Share on other sites



I just installed newest version of autoit and now my GUI does not work like it did.

What is the easiest way to have a button have focus but be able to type in an input and then only have to hit the enter key for it to submit

This is how I did it before and it worked perfectly until I downloaded current version

$txtUserAnswer = GUICtrlCreateInput("", 235, 200, 100, 20)

$btn = GUICtrlCreateButton("CHECK ANSWER", 125, 200, 100, 20)

GUICtrlSetState($btn, $GUI_FOCUS)

Send(@TAB)

You can set the button style to $BS_DEFPUSHBUTTON, but this will only work the first time if there are other buttons unless you destroy then recreate the button.

When you press Enter and the input has focus that input will generate an event so you can just have

$msg = GuiGetMsg()

Switch $msg

Case $input


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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