Sign in to follow this  
Followers 0
seres

GUICtrlCreateInput on mouse click, tabbed or anyfocus in it

6 posts in this topic

hello, i have an input control and some hotkeys when i want to write  in the input i have to manually disable the hotkeys, is the a way to automatically disable the hotkeys by clicking or tabbing or any other focus in the control input?

so far i have this but it doesnt work

GUICreate("input with Enter")
$ip1 = GUICtrlCreateInput("", 30, 40, 120, 22)
GUISetState()
While 1
   $msg = GUIGetMsg()
   Switch $msg
      Case - 3
         Exit
      Case $ip1
         MsgBox(262144, "ip1", "clean")
         HotKeySet("q")
        HotKeySet("w")
        HotKeySet("e")
        HotKeySet("r")
        HotKeySet("d")
   EndSwitch
   
WEnd

 

Share this post


Link to post
Share on other sites



 

From the code you posted, when you click on the Input control, the hotkeys are unregistered.  You could do all the things you mentioned above; you just reset the hotkeys when desired.

Share this post


Link to post
Share on other sites
14 minutes ago, Keithw said:

 

From the code you posted, when you click on the Input control, the hotkeys are unregistered.  You could do all the things you mentioned above; you just reset the hotkeys when desired.

here is an example of my problem, no matter how much i click the input im still getting the msg from the hotkey c, i want to click the input so it can registered the hotkey

GUICreate("input with Enter")
$ip1 = GUICtrlCreateInput("", 30, 40, 120, 22)
GUISetState()

HotKeySet("c", "check")
While 1
   $msg = GUIGetMsg()
   Switch $msg
      Case - 3
         Exit
      Case $ip1
         MsgBox(262144, "ip1", "clean")
         HotKeySet("c")

   EndSwitch

WEnd

Func check()
    MsgBox(0,"hey", "func activated")
EndFunc

 

Share this post


Link to post
Share on other sites

Something like this?

#include <GUIConstantsEx.au3>

HotKeySet("c", "check")

$hGui = GUICreate("input with Enter")
$ip1 = GUICtrlCreateInput("", 30, 40, 120, 22)
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_PRIMARYUP
            $aCur = GUIGetCursorInfo($hGui)
            If IsArray($aCur) Then
                If $aCur[4] = $ip1 Then
                    MsgBox(262144, "ip1", "clean")
                    HotKeySet("c")
                EndIf
            EndIf
    EndSwitch
WEnd

If you click in the input label this will unset the hotkey.

Share this post


Link to post
Share on other sites
13 minutes ago, MichaelHB said:

Something like this?

#include <GUIConstantsEx.au3>

HotKeySet("c", "check")

$hGui = GUICreate("input with Enter")
$ip1 = GUICtrlCreateInput("", 30, 40, 120, 22)
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_PRIMARYUP
            $aCur = GUIGetCursorInfo($hGui)
            If IsArray($aCur) Then
                If $aCur[4] = $ip1 Then
                    MsgBox(262144, "ip1", "clean")
                    HotKeySet("c")
                EndIf
            EndIf
    EndSwitch
WEnd

If you click in the input label this will unset the hotkey.

wow thanks thats what i needed :)

Share this post


Link to post
Share on other sites
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>

Global $hMain = GUICreate("input with Enter")
$ip1 = GUICtrlCreateInput("", 30, 40, 120, 22)

GUIRegisterMsg($WM_COMMAND, WM_COMMAND)

GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case -3
            Exit
    EndSwitch
WEnd

Func WM_COMMAND($hWnd, $iMsg, $lParam, $wParam)
    Local $iIdFrom = _WinAPI_LoWord($lParam)
    Local $iCode = _WinAPI_HiWord($wParam)

    Switch ($hWnd)
        Case $hMain
            Switch ($iIdFrom)
                Case $ip1
                    Switch ($iCode)
                        Case $EN_SETFOCUS
                            ; Disable all of your hotkeys
                        Case $EN_KILLFOCUS
                            ; Enable all of your hotkeys
                    EndSwitch
            EndSwitch
    EndSwitch

    Return "GUI_RUNDEFMSG"
EndFunc   ;==>WM_SETFOCUS

 

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  
Followers 0