Jump to content
Sign in to follow this  

[Solved] Problem with Edit control - GUISetAccelerators

Recommended Posts


In my script I'm using the following code :

Global $Arr[1][2] = [["{ENTER}", $Enter_KEY]]

So when the "Enter" key is used, some fuction are executed based on the Control currently focused.

It works vers well for my 2 input boxes, but it breaks" the "$ES_WANTRETURN" flag I'm using for my Edit control.

I've written a custom Func which reproduce the line feed/carriage return in the edit box, and i'm using this func to replace the carret on the correct line : https://www.autoitscript.com/forum/topic/118476-how-to-position-the-cursor-in-a-multi-line-edit/?tab=comments#comment-824334

But is there a way to skip this control so it receive the normal message and performs a carriage return like it would without an accelerator ?

Edited by Jojo-OP2

Share this post

Link to post
Share on other sites
Case $msg = $Enter_KEY
      If ControlGetFocus ($hGUI) = "Edit2" Then ControlSend ($hGUI,"","Edit2", @LF)

Something as simple as that ?

Share this post

Link to post
Share on other sites
19 minutes ago, Jojo-OP2 said:

Thanks ! It works flawlessly.


Another easy solution is to use notification like this :


Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)

  Local $iIDFrom = _WinAPI_LoWord($wParam)
  Local $iCode = _WinAPI_HiWord($wParam)
  If $iIDFrom = $idEdit Then
    If $iCode = $EN_SETFOCUS Then GUISetAccelerators("")
    If $iCode = $EN_KILLFOCUS Then GUISetAccelerators($Arr)

EndFunc   ;==>_WM_COMMAND


Share this post

Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...