Jump to content

Recommended Posts

Posted

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.

Posted

Add Case $editname To your while and add your function code under it.

That way only works if I press enter on the edit control. I want the information to be displayed instantly.

Posted (edited)

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]

Posted

I know your code will work but I don't always want to see if it has changed. It will cause higher CPU usage. I'm not too sure if it is possible but can you use GUIRegisterMsg.

Posted

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

;)

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
×
×
  • Create New...