Vladi243 Posted June 27, 2008 Share Posted June 27, 2008 Is there a way to make the GUI focus only on the input, even if I press on a button? Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 27, 2008 Share Posted June 27, 2008 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 More sharing options...
Vladi243 Posted June 27, 2008 Author Share Posted June 27, 2008 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 More sharing options...
MerkurAlex Posted June 27, 2008 Share Posted June 27, 2008 (edited) 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 June 27, 2008 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 More sharing options...
PsaltyDS Posted June 27, 2008 Share Posted June 27, 2008 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 More sharing options...
MerkurAlex Posted June 27, 2008 Share Posted June 27, 2008 (edited) 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 June 27, 2008 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 More sharing options...
Vladi243 Posted June 27, 2008 Author Share Posted June 27, 2008 Thanks guys, all the possibilities that you suggested is working, but they making the script slow for me (there some special things in the script that I can't tell you). The most fast is what MarkurAlex suggested. ControlFocus () GUICtrlSendMsg ($PasswordInput, $EM_SETSEL,1000,1000) I think that I'll use this option. Thanks again guys. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now