Razi Posted February 19 Share Posted February 19 (edited) Can you help solve the problem in code? The problem is that in the following code, when I press backspace in any Input control or any other keyboard button, the value is returned back. For example: when I want to change the value 127 in the input control and I erase the number 7 with the backspace button, the number becomes 127 again. But I need the number to change when any keyboard button is pressed. expandcollapse popup#include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <Timers.au3> #Include <WinAPIEx.au3> #include <Misc.au3> #Region ### START Koda GUI section ### Form= Local $Form1 = GUICreate("Form1", 658, 401, 192, 124) Local $aInput, $c = 0 Global $nMsg For $y = 0 To 8 For $a = 0 To 14 $aInput[$c] = GUICtrlCreateInput('Input' & $a+1 + $y*15, 26+$y*53, 31+$a*22 , 52, 21) $c += 1 Next Next Global $timedelay = _Timer_Init() ;Start delay timer GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") Global $timersec = 2000 While 1 $nMsg = GUIGetMsg() local $inp = $nMsg - $aInput Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $aInput To $aInput[UBound($aInput) - 1] $timersec = 3600000 ConsoleWrite($timersec & @CRLF) ConsoleWrite($inp & @CRLF) $val = Number(GUICtrlRead($nMsg)) If $val <> 0 And _IsPressed("0D") Then $val = Number(GUICtrlRead($nMsg)) local $inp = $nMsg - $aInput GUICtrlSetData($aInput[$inp], $inp) ConsoleWrite($val & @CRLF) $timersec = 2000 EndIf ;ConsoleWrite("Input " & $nMsg - $aInput & " has been modified" & @CRLF) EndSwitch If _Timer_Diff($timedelay) > $timersec Then For $x = 0 To 134 GUICtrlSetData($aInput[$x], $x) Next $timedelay = _Timer_Init() ;Reset delay timer EndIf WEnd Func WM_COMMAND($hWinHandle, $iMsg, $wParam, $lParam) If _WinAPI_HiWord($wParam) = $EN_CHANGE Then Switch _WinAPI_LoWord($wParam) Case $aInput To $aInput[UBound($aInput) - 1] local $inp = $nMsg - $aInput ConsoleWrite($inp & @CRLF) EndSwitch EndIf EndFunc Without changing the following part of the code: If _Timer_Diff($timedelay) > $timersec Then For $x = 0 To 134 local $number = 132* Int($x / 15) + Mod($x,15) GUICtrlSetData($aInput[$x], $x) Next $timedelay = _Timer_Init() ;Reset delay timer EndIf In general, I want to pause the timer when any button on the keyboard was pressed in any Input GUI control, but the code manages to execute this part of the code: GUICtrlSetData($aInput[$x], $x) , although it should not execute it after pressing the keyboard button in any Input GUI control. Edited February 19 by Razi Link to comment Share on other sites More sharing options...
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
Already have an account? Sign in here.Sign In Now