Jump to content

Simple gui with a button? I'm missing something basic!


Strydr
 Share

Recommended Posts

I thought I understood this but a simple script isn't working.  What am I missing?  Yes, I'm expecting to feel very stupid, but thanks for the help!  I was working on learning arrays and all of a sudden realized that I seem to have forgotten some basics!

What am I missing?  Why won't the button activate the function "_TestFunc" "OnEvent"?  Thank you!

 

Quote

#include <GUIConstantsEx.au3>
#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)

$GUI = GUICreate("Test GUI", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_SYSMENU, $WS_EX_CLIENTEDGE))
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")

Global $testbutton = GUICtrlCreateButton("test", 100, 50)
GUISetOnEvent($testbutton, "_TestFunc")

GUISetState(@SW_SHOW)

While Sleep(100)
WEnd

Func Quit()
    Exit
EndFunc

Func _TestFunc()
    MsgBox(0, "", "testing")
EndFunc

 

Edited by Strydr
Link to comment
Share on other sites

"Am I missing something basic?"  Yes. :)

Use, GUICtrlSetOnEvent($testbutton, "_TestFunc"))  Not GUISetOnEvent($testbutton, "_TestFunc")

Edited by Xandy
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...