Jump to content

Inputbox: tecting Changes


Recommended Posts

Does anyone know how you can detect when the user changes the value of an inputbox? For example is the value is "Open" and the user drags and drops the value "Close" into it, how can I handle this event? Thanks for any help.

Link to comment
Share on other sites

While 1
if $input<>"Open" then
mgbox(64,"","you changed it ...")
endif
Wend

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Link to comment
Share on other sites

Does anyone know how you can detect when the user changes the value of an inputbox? For example is the value is "Open" and the user drags and drops the value "Close" into it, how can I handle this event? Thanks for any help.

This will tell you what is in the inputbox all the time it is displayed.

Global $handle, $SetTimer
Dim $Folder

$handle = DllCallbackRegister("_ReadIPBox", "int", "")
$SetTimer = DllCall("User32.dll", "int", "SetTimer", "hwnd", 0, "int", 0, "int", 500, "ptr", DllCallbackGetPtr($handle))
$SetTimer = $SetTimer[0]


$answer = InputBox("Question", "Where were you born?", "Planet Earth", "", _
    -1, -1, 0, 0)
    
    
     DllCallbackFree($handle)
        DllCall("user32.dll", "int", "KillTimer", "hwnd", 0, "int", $SetTimer)
        
Func _ReadIPBox()
    If WinExists("Question") Then
        ConsoleWrite(ControlCommand("Question","Where were you born?","Edit1","GetLine", 1) & @CRLF)
    EndIf
EndFunc
Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Using EN_CHANGE notification:

#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#include <WIndowsConstants.au3>
#include <WinAPI.au3>

$GUI = GuiCreate("Input change test",200,60)
$Input = GUICtrlCreateInput("Type Here",10,15,180,30)

GuiRegisterMsg($WM_COMMAND,"WM_COMMAND")

GuiSetState()

Do
Until GUiGetMsg() = $GUI_EVENT_CLOSE

Func WM_COMMAND($hWnd,$msgID,$wParam,$lParam)
    If _WinAPI_HiWord($wParam) = $EN_CHANGE Then
        MsgBox(0,"Text Changed","New Text :" & GUICtrlRead($Input))
    EndIf
EndFunc
Link to comment
Share on other sites

@ d4rk, danielkza

The op asked for inputbox not GuiCtrlCreateInput. If NumberDaemon meant GuiCtrlCreateInput then I think danielkza's solution is correct and mine in incorrect.

@ d4rk

To read the contents of an input you need GuiCtrlRead($input).

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...