Jump to content

Recommended Posts

Posted

I want to know if it is possible to call a function each time the text in an input box change...

And, is it possible to do the same thing with radiobutton? Every time it is checked and unchecked...

Thanks to all!

Posted

You can use OnEventMode, which i perfer, Opt("GUIOnEventMode",1)

Then you can GUICtrlSetOnEvent()

Which will notefiy the script once the button is checked or unchecked.

Posted

Perhaps this gives you the idea of concept.

GUICreate('Example')
GUICtrlCreateLabel('type: hello', 5, 5)
$input_1 = GUICtrlCreateInput('', 5, 20, 100)
GUISetState()

While 1
    $input = GUICtrlRead($input_1)
    Switch GUIGetMsg()
        Case -3
            Exit
    EndSwitch
    Select
        Case $input = ''
            ContinueLoop
        Case  $input = 'hello'
            _Function()
    EndSelect
WEnd

Func _Function()
    GUICtrlSetData($input_1, 'hello world')
EndFunc
Posted (edited)

Yes, I understand, but with this method, the function is in loop!

And, I want a method to run the function one time!

Just use a condition. :)

GUICreate('Example')
GUICtrlCreateLabel('type: hello', 5, 5)
$input_1 = GUICtrlCreateInput('', 5, 20, 100)
GUISetState()

Global $detect = True
While 1
    If $detect Then
        $input = GUICtrlRead($input_1)
    EndIf
    Switch GUIGetMsg()
        Case -3
            Exit
    EndSwitch
    Select
        Case $input = ''
            ContinueLoop
        Case  $input = 'hello '
            $detect = False
            $input = ''
            _Function()
    EndSelect
WEnd

Func _Function()
    GUICtrlSetData($input_1, 'hello world')
EndFunc

Edit:

Added a variable reset to ''

Edited by MHz

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...