Search the Community
Showing results for tags 'wm_command inputbox'.
-
I am having trouble with setting up a "read as you type" function. I want to have an input box that will run a function every time its value changes. I do not want to launch the function under the WM_command function. Because I would have to almost rewrite the entire script it is going to be used in, and introduce a billion global variables. Ideally I would like zero globals, but at most one for WM_command. As it is in the example below, the function will run only when some event is returned from _guigetmsg(), which is logical, but is not the behavior I want. also, I do not want the function to run every time any key is pressed, only when the value of the input box changes. TIA, for any input. #region- Gui includes #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #endregion - includes Global $gsWM_returnit, $Input1 GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") _testgui() Func _testgui() Local $nMsg #region ### START Koda GUI section ### Form= Local $Form1 = GUICreate("Form1", 412, 382, 192, 124) $Input1 = GUICtrlCreateInput("Input1", 40, 48, 265, 21) Local $List1 = GUICtrlCreateList("", 40, 72, 265, 175) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case 0 ContinueLoop Case -11 ContinueLoop Case $GUI_EVENT_CLOSE Exit Case $Form1 Case $List1 Case $Input1 Case Else EndSwitch If $gsWM_returnit<>"" Then _DoSomething($gsWM_returnit) WEnd EndFunc ;==>_testgui Func _DoSomething($sStuff) ConsoleWrite("Return:"&$sStuff& @LF) endfunc Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Switch _WinAPI_HiWord($wParam) Case $EN_CHANGE $gsWM_returnit = GUICtrlRead($Input1) ;~ ConsoleWrite($gsWM_returnit & @LF) Case $hWnd Case $iMsg Case $lParam Case Else $gsWM_returnit = "" EndSwitch EndFunc ;==>WM_COMMAND