Sign in to follow this  
Followers 0
BlueDragonBall

Use function every inputbox text change...

8 posts in this topic

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!

Share this post


Link to post
Share on other sites



Use GuiCtrlRead() within your loop to constantly check the controls of interest.

:)

Share this post


Link to post
Share on other sites

How can I make this?

But my question is: is there a function like GUIGetMsg() for Gui controls?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites

You will have to put the func in a loop if you want to detect an inputbox's text has changed in RealTime.

Share this post


Link to post
Share on other sites

#8 ·  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

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