Jump to content

Check if value change


Go to solution Solved by UEZ,

Recommended Posts

Hello, i need an help

I need to check in a loop if a value change. I'll expalin better

I have an inputbot with value = 10

I'll change the value to = 12 it's different to 10 so do func MyFunc()

I'll change the value to = 11 it's different to 12 so do func MyFunc()

In real temp because i need it a loop

If i put GUICtrlRead in the While...WEnd is too much because check every time. How to store the old value in a variable and the see if it change?

Thanks, tell me if i wasn't clear

Edited by MyEarth
Link to comment
Share on other sites

  • Solution

Something like this here?

 

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

$iPrevious = 10

GUICreate("Test", 300, 200)
$iInp = GUICtrlCreateInput($iPrevious, 20, 90, 30, 20, $ES_NUMBER)
$iLbl = GUICtrlCreateLabel("Enter a number and press Return", 60, 92)
$iBtn = GUICtrlCreateButton("X", 250, 150, 40, 40)
GUISetState()

Do
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $iBtn
            GUIDelete()
            Exit
        Case $iInp
            $iCurrent = GUICtrlRead($iInp)
            If $iCurrent <> $iPrevious Then
                $iPrevious = $iCurrent
                F()
            EndIf
    EndSwitch
Until False

Func F()
    MsgBox(0, "Function Call", "Function was called")
    Return 1
EndFunc

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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