Sign in to follow this  
Followers 0
MyEarth

Check if value change

5 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Not ;)

I don't know the value, can be 1000 or 1, so i can't make a Case for everyone. Thanks

Share this post


Link to post
Share on other sites

I just update the code.

Br,

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Thanks, now can match to my problem. Thanks ;)

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  
Followers 0