pixelsearch Posted October 23, 2020 Posted October 23, 2020 5 hours ago, Jos said: Does anybody know why we need to set the focus as I would have thought the Windows Message was send to the control without the requirement for giving it the focus? In case it may help, here is what MS stipulates about EM_SETSEL message sent by _GUICtrlEdit_SetSel() If the edit control has the ES_NOHIDESEL style, the selected text is highlighted regardless of whether the control has focus. Without the ES_NOHIDESEL style, the selected text is highlighted only when the edit control has the focus. Also Lazycat indicated in this post (15 years ago) that the focus was required before sending the message. Which isn't totally true as one can set the focus before or after having sent the message, it still will show the selection. I just checked my CSV file editor and found this code in it, where the focus is given after the message is sent : _GUICtrlEdit_SetSel($g_hEdit, 0, -1) ; select all text _WinAPI_SetFocus($g_hEdit) So now that everybody tested GUICtrlSetState() and ControlFocus() in PROD and BETA 1&2&3, why not testing this 3rd way in OP script : _WinAPI_SetFocus(ControlGetHandle($gGUI, "", $edit)) These tests will never end "I think you are searching a bug where there is no bug." "Don't listen to bad advice."
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