Jump to content

Focus input always


Recommended Posts

Is there a way to make the GUI focus only on the input, even if I press on a button?

Not exactly, but you could put it back very quickly with ControlFocus(). If necessary you could check/restore focus continuously in a loop.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Not exactly, but you could put it back very quickly with ControlFocus(). If necessary you could check/restore focus continuously in a loop.

:)

Yes, I know that I can use ControlFocus(), and I've already tried it. The problem is that this function always selects the content in the input. I want that the content will be unselected.
Link to comment
Share on other sites

guictrlsendmsg($input,$EM_SETSEL,1000,1000)

I believe that would select the ending of the input after you focus it so nothing would be selected if that's what you want.

EDIT: Also controlfocus doesn't select all the text for me....

Edited by MerkurAlex

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Link to comment
Share on other sites

Yes, I know that I can use ControlFocus(), and I've already tried it. The problem is that this function always selects the content in the input. I want that the content will be unselected.

That's tricky. You can restore focus with ControlFocus() then immediately ControlSend() an "{END}" to put the cursor at the end of the string. I don't know how you would restore focus AND return the cursor to a previous position in the middle of the string...

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

That's tricky. You can restore focus with ControlFocus() then immediately ControlSend() an "{END}" to put the cursor at the end of the string. I don't know how you would restore focus AND return the cursor to a previous position in the middle of the string...

:)

I would use my guictrlsendmsg but yes that would also work.

Have you tried this i doubt its any different:

GUICtrlSetState($input,$GUI_FOCUS)

[EDIT]

I bet you could use GUICtrlGetState to see if it has focus if it does set a global variable to GUICtrlRecvMsg with $em_getsel(i think) in a loop and then when it looses focus refocus it and use my GUICtrlSendMsg with $em_setsel to 0,global variable.

Edited by MerkurAlex

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

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