Jump to content
Sign in to follow this  
gte

How to trigger two functions off of one guictrlsetonevent?

Recommended Posts

gte

Since you cannot have a function inside of a function, I'd like to know how to trigger 2 (or more) functions off of one gui event, specifically the guictrlsetonevent?

Here is an example I believe, it's not working of course though, but gives the general idea I think?

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


$Form1 = GUICreate("Form1", 633, 447, 1527, 244)
$update = GUICtrlCreateButton("Run 2 functions with one click of this button", 192, 112, 179, 113, BitOR($BS_VCENTER,$BS_MULTILINE))
GUISetState(@SW_SHOW)



GUICtrlSetOnEvent($update, "update2")

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

    EndSwitch
WEnd



    



func update1()

    RunWait('notepad.exe', @WindowsDir)

endfunc

func update2()

RunWait('calc.exe', @WindowsDir)

endfunc


Func CLOSEClicked1()
    Exit
EndFunc


Func CLOSEClicked2()
    Exit
EndFunc

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.