Jump to content
Sign in to follow this  

Detecting text change for input control

Recommended Posts


Would it be possible to receive a message that fires whenever the text in an input box changes? As far as I can tell, the current behavior of GUIGetMsg with input boxes is that it fires when the input loses focus and the text has changed since it last received the focus. Unfortunately I don't think there is any other function that will automatically idle the CPU in a tight loop if there is no new message available. Any ideas here?

I found this while searching around, may be of some use to those who understand it:


Share this post

Link to post
Share on other sites

using the beta and UDFs you could do it this way


#include <GUIConstants.au3>

#include <GuiEdit.au3>

opt('MustDeclareVars', 1)

Dim $myinput, $ret, $Status, $msg, $current, $Btn_Empty

GUICreate("Edit Empty Undo Buffer", 392, 254)

$myinput = GUICtrlCreateInput("some text", 140, 32, 121)

$Btn_Empty = GUICtrlCreateButton("Emtpy Buffer", 150, 150)

$Status = GUICtrlCreateLabel("Nothing to Undo", 0, 234, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))


; Run the GUI until the dialog is closed

While 1

$msg = GUIGetMsg()

$ret = _GUICtrlEditCanUndo ($myinput)

If ($ret <> $current) Then

If ($ret == 0) Then

GUICtrlSetData($Status, "Nothing to Undo")


GUICtrlSetData($Status, "Undo Available")


$current = $ret



Case $msg = $GUI_EVENT_CLOSE


Case $msg = $Btn_Empty

_GUICtrlEditEmptyUndoBuffer ($myinput)



SciTE for AutoItDirections for Submitting Standard UDFs


Don't argue with an idiot; people watching may not be able to tell the difference.


Share this post

Link to post
Share on other sites

*smacks head* Wow, I didn't even notice those GuiEdit UDFs... I kind of forgot that an Input is the same thing as an Edit. Surprisingly, I put _GUICtrlEditGetModify in a tight loop (much as you did with the Undo function) and it doesn't consume any CPU cycles that I can see. I wouldn't think that would be the case when you're checking for a condition repeatedly as fast as possible. Thanks for the help!

Share this post

Link to post
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
Sign in to follow this