Jump to content

do func () on $edit1 change


au3scr
 Share

Recommended Posts

Hi all.

I am trying to run function every time $Edit1 is changed, but script made by koda dont work... I mean when I change text in $Edit1 then nothing happens.

What I need to do to have action on edit1 change?

I also tried Case $edit1.change as it is in most languages I've seen but thistime it didnt work.

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

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 202, 111, 193, 125)
$Edit1 = GUICtrlCreateEdit("", 8, 8, 185, 89)
GUICtrlSetData(-1, "Edit1")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Edit1
            do_Func ()          
    EndSwitch
WEnd

Func do_Func ()
MsgBox (1,"I Am function","which makes me cool")
EndFunc
Link to comment
Share on other sites

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <Timers.au3>
$start=_Timer_Init()
$test = "Edit1"
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 202, 111, 193, 125)
$Edit1 = GUICtrlCreateEdit("", 8, 8, 185, 89)
GUICtrlSetData(-1, "Edit1")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case _timer_diff($start) = 2
        If $test <> guictrlread($edit1) then
              do_Func ()     
              $test = guictrlread($Edit1)
              $start=_Timer_Init()
        Else
              $test = guictrlread($Edit1)
              $start=_Timer_Init()
        Endif
        
        Case $GUI_EVENT_CLOSE
            Exit

        
    EndSwitch
WEnd

Func do_Func ()
MsgBox (1,"I Am function","which makes me cool")
EndFunc

Giggity

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