Jump to content

_GUICtrlEdit_SetSel() does not work in Beta v3.3.15.3.


patshi
 Share

Recommended Posts

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 :lmao:

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