Jump to content

[solved] Focus to button after input filled


Recommended Posts

Hi,

I have a GUI with an input field limited to 6 characters [digits required, but this is checked later]

Below it is a button that runs a function that reads the input, then odes stuff with it.

My question is, how can I make the button take focus as soon as the user has filled the input box with the 6 characters

. He would then type in 6 digits and hit return to run the function, rather tan tabbing or mouse-clicking the button.

I'm running in OnEventMode and the relevant bit of code is:

GUICtrlCreateLabel("Enter Hospital Number", 90, 190)
$HSPinput= GUICtrlCreateInput("", 120, 215, 50)
$limit = GUICtrlSetLimit($HSPinput, 6)

$browse = GUICtrlCreateButton("Browse Letter Content", 50, 245, 200)
GUICtrlSetTip (-1, "Opens the chronological record of letter content", "Letter Browser")

I've tried GUICtrlSetOnEvent($browse, "browse") but it loses focus as soon as the user starts the data entry.

Regards,

William

Edited by saywell
Link to comment
Share on other sites

Put $BS_DEFPUSHBUTTON as style for the button and in the function check if the input is 6 characters long.

[edit] for the input, you can set directly GUICtrlSetLimit($hInputID, 6)

Edited by taietel
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...