Jump to content

Use function every inputbox text change...


Recommended Posts

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
Link to comment
Share on other sites

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