Jump to content

detect change on edit control


 Share

Recommended Posts

How would I detect a change on an edit control. For example, when I type something into the edit control, it will do a function but when not typing, it will not. I know that putting the function in the While section will work but I do not want to always call it when typing is inactive.

Link to comment
Share on other sites

You could do a

GUICtrlReadoÝ÷ ÚÚ+zÚâz÷­çZµ«azw(«z+m£Z·¬¦·¯¬,+Û^LZ^jëh×6If GUICtrlRead($editname) = $old Then
[indent]$old=GUICtrlRead($editname)[/indent]
Else
[indent]$old=GUICtrlRead($editname)
TheFunction()[/indent]
EndIf

(WHY DO YOU FAIL ME INDENT TABS?!?! WHY!?!?!?!)

You'd put the above code in your while and be sure to say something like $old="" or Local $old before the while so you don't get an error that the variable doesn't exist.

Edited by bam5

[center]JSON Encoding UDF[/center]

Link to comment
Share on other sites

jercfd

Try this:

#include <GuiConstantsEx.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>

$hGui = GUICreate("Test GUI", 300, 200)

$hEdit = GUICtrlCreateEdit("", 10, 10, 280, 180)

GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

GUISetState()

While GUIGetMsg() <> -3
    ;
WEnd

Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
    Local $IdFrom, $iCode
    
    $IdFrom = BitAnd($wParam, 0x0000FFFF)
    $iCode = BitShift($wParam, 16)
    
    Switch $IdFrom
        Case $hEdit
            Switch $iCode
                Case $EN_UPDATE
                    ConsoleWrite("!> Changes on edit control detected" & @LF)
            EndSwitch
    EndSwitch
    
    Return $GUI_RUNDEFMSG
EndFunc

;)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...