Jump to content

How to trigger two functions off of one guictrlsetonevent?


Recommended Posts

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