Jump to content

Check if GUI control is active


Recommended Posts

I am trying to make my program user friendly by having an input box that, when it has been clicked in, will capture the keys pressed. Similar to how many other programs do, when you click in the box and then press, say, Ctrl+Alt+K, it will turn the text box into this, and if you take your finger off Alt, it will change to Ctrl+K. I've been searching the forum, and i found that i should probably use the IsPressed function, although i can see this being quite a long piece of code. However, i don't know how to find out when/if the textbox is selected. Is there a blindingly obvious way to do this that i've stupidly missed, or is this something difficult to do? I already have a function that will convert strings with keys stored in the form that the Send() function uses to user-friendly language, incase anyone knows a better way than IsPressed().

Thanks, and sorry if this is obvious and/or has been asked before...

Link to comment
Share on other sites

*feels stupid*

when i couldn't find anything in search, i looked through the commands that start "GUICtrl..." and then "GUI..."... never thought of looking for something that wasn't autoit gui specific...

one thing though... i'm using an onEvent GUI, so would i have to do this in my empty while loop at the top and constantly poll the GUI...? The GUI won't be open for most, if not all, off the time the program is running, so this seems like a slight waste of CPU time... Any ideas...?

Link to comment
Share on other sites

There are already a couple of scripts in the example scripts forum that do things like this, maybe they can help you.

Hotkey Inputboxes

_ChooseHotKey UDF

HotKey Selector window

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