Jump to content
Jojo-OP2

[Solved] Problem with Edit control - GUISetAccelerators

Recommended Posts

Posted (edited)

Hi,

In my script I'm using the following code :

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

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
Solved

Share this post


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

Thanks ! It works flawlessly.

:thumbsup:

Another easy solution is to use notification like this :

GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")

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)
  EndIf
  Return $GUI_RUNDEFMSG

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

×
×
  • Create New...