cbielich Posted December 29, 2015 Share Posted December 29, 2015 (edited) I useGUIRegisterMsg($WM_COMMAND, "ED_WM_COMMAND") to captureCase $EN_SETFOCUS OR $EN_CLICK events.When using _IsPressed with Function Keys (F1 - F12) it does not work unless the function is the while 1 loop. I can get all my other events to trigger with _IsPressed just fine except Function KeysWorking Example: (Click on Numpad 1 too see it work, F1 does not workexpandcollapse popup#include <IE.au3> #include <Array.au3> #include <Constants.au3> #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <Misc.au3> #include <WindowsConstants.au3> #include <GuiComboBox.au3> #include <MsgBoxConstants.au3> Global $hGUI = GUICreate("Button", 700, 360) Global $hDLL = DllOpen("user32.dll") GUISetBkColor(0x00E0FFFF) GUISetFont(9, 300) GUICtrlCreateTab(10, 10, 680, 340) GUICtrlCreateTabItem("Content") GUICtrlSetState(-1, $GUI_SHOW) ; will be display first Global $button1 = GUICtrlCreateInput("", 20, 60, 53) GUISetState(@SW_SHOW, $hGUI) GUIRegisterMsg($WM_COMMAND, "ED_WM_COMMAND") Func ED_WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg Local $iCode = BitShift($wParam, 16) Switch $lParam Case GUICtrlGetHandle($button1) Switch $iCode Case $EN_SETFOCUS OR $EN_CLICK KeyDetect($button1) ;<== Here I am detecting which input field is clicked in to put a value into the input later EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>ED_WM_COMMAND Func KeyDetect($whichinput) ;This event below works fine calling (Numeric keypad 1 key) and placing into the input field a value of "N1" If _IsPressed("61", $hDLL) Then GUICtrlSetData($whichinput, "N1") EndIf ;This event below DOES NOT work calling (F1) and DOES NOT place a value of "F1" into the input field. If _IsPressed("70", $hDLL) Then GUICtrlSetData($whichinput, "F1") EndIf EndFunc While 1 $msg = GuiGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEndThe only way to get the If _IsPressed("70", $hDLL) Then EndIfTo work is if I place it in the While 1 loop Edited December 29, 2015 by cbielich Link to comment Share on other sites More sharing options...
mikell Posted December 30, 2015 Share Posted December 30, 2015 Case $EN_SETFOCUS OR $EN_CLICK ($EN_CLICK doesn't exist) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now