Jump to content

Detect changes to an edit control


newcoder
 Share

Recommended Posts

I can answer most of my own questions with online documentation and searching the forums, but I didn't see anything relevant in the forum and do not know what to took for in the documentation. I'd like to have a disabled save button that becomes enabled when the text in an edit control is changed.

I can't use GUIOnEventMode as I still need to watch GUIGetMsg.

I tried watching GUIGetMsg for the ControlID of the edit control which was almost usable, but it does not respond till the control losses focus instead of when it gets focus.

Sorry I don't have any sample code, but I don't know how to do this in Autoit. What can I use to detect changes to the edit control?

Thanks.

Link to comment
Share on other sites

Maybe...

#include <guiconstantsEx.au3>

Global $hTemp = "This is the normal text"

GUICreate("Test")
$Edit1 = GUICtrlCreateEdit("This is the normal text", 10, 20, 200, 150)
$button = GUICtrlCreateButton("Disable", 150, 250, 100, 25)
GUICtrlSetState($button, $GUI_DISABLE)
GUISetState()

While GUIGetMsg() <> -3

    $Info = GUICtrlRead($Edit1)
    If $Info <> $hTemp Then
        $hTemp = $Info
        GUICtrlSetState($button, $GUI_ENABLE)
    EndIf

WEnd

8)

NEWHeader1.png

Link to comment
Share on other sites

welcome to the forums newcoder

examples are on the forum

search for EN_UPDATE or EN_CHANGE

use WM_COMMAND message handler: GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

use hiword of wparam in message handler for EN_UPDATE or EN_CHANGE notifications

notifies of any change in an Edit control

I see fascists...

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...