Jump to content

Sending "Clicked" message to GUI?


Recommended Posts

is there a way that I could make the GUI think that a button is clicked, when another button is pressed using GUISetOnEvent mode? (I know i could just make it go to the same function, or use a hotkeyset / send combination, but is there any function that does it automagically?)

Opt("GuiOnEventMode", 1)

GUICreate("Test")

Global $B1 = GUICtrlCreateButton("Exit!", 10, 10)
GUICtrlSetOnEvent($B1, "transferclick")

Global $B2 = GUICtrlCreateButton("NOW!", 10, 40)
GUICtrlSetOnEvent($B2, "exitnow")

GUISetOnEvent(-3, "exitnow")
GUISetState()

While 1
    
    Sleep(100000)
    
WEnd

Func transferclick()
;@GUI_CtrlId = $B2; doesn't work :(
EndFunc

Func exitnow()
    Exit
EndFunc

What goes around comes around... Payback's a bitch.

Link to comment
Share on other sites

Hi,

Opt("GuiOnEventMode", 1)

GUICreate("Test")

$B1 = GUICtrlCreateButton("Exit!", 10, 10)
GUICtrlSetOnEvent(-1, "Event")
$B2 = GUICtrlCreateButton("NOW!", 10, 40)
GUICtrlSetOnEvent(-1, "Event")

GUISetOnEvent(-3, "Event")
GUISetState()

While 1
    Sleep(100)
WEnd

Func Event()
    $msg = @GUI_CtrlId
    Switch $msg
        Case $B1, $B2, -3
            Exit
        Case Else
            ;;;
    EndSwitch
EndFunc

Cheers

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