Jump to content

Search the Community

Showing results for tags 'EventMode'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Location


WWW


Interests

Found 1 result

  1. I have a GUI with several input boxes and I want to trap the ENTER key so I can call handlers for each one. However, when I put in a HotKeySet() to trap the ENTER key, it traps it OK, but I also get traps when I press the ENTER key anywhere else on my desktop, no matter what GUI has focus, so I changed the code to use GUISetAccelerators(). I cannot see how to attach a handler for the ENTER key for each of my input controls. My real script uses event mode (Opt("GUIOnEventMode", 1)), so that's what I'm using in my test code. Here is my test code: #NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstantsEx.au3> #include <StructureConstants.au3> OnAutoItExitRegister("ExitStageLeft") Opt("GUICloseOnESC", 1) Opt("GUIEventOptions", 1) Opt("GUIOnEventMode", 1) ;; <===== Opt("WinTitleMatchMode", 1) Opt('MustDeclareVars', 1) Global $hWnd_list1, $hWnd_input1, $hGUI, $sWinTitle Global $iID_list1, $iID_input1 _Main() Exit (1) Func _Main() $sWinTitle = "ENTER key trap test" $hGUI = GUICreate($sWinTitle, 500, 230) GUICtrlCreateButton("Test", 5, 5, 50, 25) $iID_input1 = GUICtrlCreateInput("input1", 70, 5, 100, 25) $hWnd_input1 = GUICtrlGetHandle($iID_input1) $iID_list1 = GUICtrlCreateEdit("list1", 10, 40, 475, 190) $hWnd_list1 = GUICtrlGetHandle($iID_list1) GUICtrlSetData($iID_list1, "abcdefghijklmnopqrstuvwxyz" & @CRLF, 1) ConsoleWrite("+++: $iID_list1 = " & $iID_list1 & @CRLF) ConsoleWrite("+++: $iID_input1 = " & $iID_input1 & @CRLF) GUISetState() GUICtrlSetOnEvent($iID_list1, "handle_List1") GUICtrlSetOnEvent($iID_input1, "handle_Input1") GUISetOnEvent($GUI_EVENT_CLOSE, 'ExitStageLeft') Local $aAccelKeys[2][2] $aAccelKeys[0][0] = "{ENTER}" $aAccelKeys[0][1] = $iID_input1 $aAccelKeys[1][0] = "{ENTER}" $aAccelKeys[1][1] = $iID_list1 GUISetAccelerators($aAccelKeys) While (1) Sleep(250) WEnd EndFunc ;==>_Main Func ExitStageLeft() Exit (0) EndFunc ;==>ExitStageLeft Func handle_Input1() ConsoleWrite("+++: handle_Input1() entered" & @CRLF) EndFunc ;==>handle_Input1 Func handle_List1() ConsoleWrite("+++: handle_List1() entered" & @CRLF) EndFunc ;==>handle_List1
×
×
  • Create New...