DeckardCain Posted April 13, 2007 Share Posted April 13, 2007 Well, I'm trying to design a GUI love story of my two friends, as a joke, and I can't freaking make this button work. I've got the button defined, an image associated with it, and whenever I apply the image to the button, it stops working. I've been trying to make this for a while now and I'm completely stumped. Here is the one in question... help me please. #include<guiconstants.au3> GUICreate( "Love Story", 800, 725) GUICtrlCreatePic( "E:\Abel Pranks\Dan Darren 3\2.bmp", -1, -1, 800,725) $D=Guictrlcreatebutton ("", 195, 0, 181, 165,$BS_BITMAP ) GUICtrlSetImage ( -1, "E:\Abel Pranks\Dan Darren 3\1.bmp") Opt ("GUIOnEventMode", 1) guisetstate (@sw_show) GUIsetonevent ($D, "D") Func D () MsgBox ( , "YOU did it", "you did it" ) EndFunc Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted April 13, 2007 Moderators Share Posted April 13, 2007 You were trying to use "GUISetOnEvent()" when you needed to use "GUICtrlSetOnEvent()". #include <GuiConstants.au3> Opt("GUIOnEventMode", True) GUICreate("Love Story", 800, 725) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") GUICtrlCreatePic("E:\Abel Pranks\Dan Darren 3\2.bmp", -1, -1, 800, 725) GUICtrlCreateButton("", 195, 0, 181, 165, $BS_BITMAP) GUICtrlSetOnEvent(-1, "_Click") GUICtrlSetImage(-1, "E:\Abel Pranks\Dan Darren 3\1.bmp") GUISetState(@SW_SHOW) While 1 Sleep(100) WEnd Func _Click() MsgBox(0, "YOU did it", "you did it") EndFunc ;==>_Click Func _Exit() Exit EndFunc ;==>_Exit Link to comment Share on other sites More sharing options...
DeckardCain Posted April 13, 2007 Author Share Posted April 13, 2007 haha thank you. like i said, am a newb Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted April 13, 2007 Moderators Share Posted April 13, 2007 No problem, glad I was able to help. Link to comment Share on other sites More sharing options...
DeckardCain Posted April 19, 2007 Author Share Posted April 19, 2007 Check it.. I C+P'd that into my script... and it stopped working again . I think I may just be missing something, but all I changed was the picture pathways... and now that the pictures are on its not working again. Sorry to be a newb at GUI, but I am lol. Any help would be much appreciated... Thanks in advance! #include <GuiConstants.au3> Opt("GUIOnEventMode", True) GUICreate("Love Story", 800, 725) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") GUICtrlCreatePic("C:\Documents and Settings\Bill\Desktop\Dan Darren 3\2.bmp", -1, -1, 800, 725) GUICtrlCreateButton("", 195, 0, 181, 165, $BS_BITMAP) GUICtrlSetOnEvent(-1, "_Click") GUICtrlSetImage(-1, "C:\Documents and Settings\Bill\Desktop\Dan Darren 3\1.bmp") GUISetState(@SW_SHOW) While 1 Sleep(100) WEnd Func _Click() MsgBox(0, "YOU did it", "you did it") EndFunc ;==>_Click Func _Exit() Exit EndFunc ;==>_Exit Oh yeah.. first thing I've ever tried wrapping in the auto it format... hopefully it worked lol. Link to comment Share on other sites More sharing options...
enaiman Posted April 19, 2007 Share Posted April 19, 2007 I don't know what's happening - the code seem to be OK ...Do you get any errors when you run the script?Do you have the "beta" version of AotoIt installed? - Opt("GUIOnEventMode", True) works on beta but in order to get it working on other versions you will need to change it to Opt("GUIOnEventMode", 1) SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
DeckardCain Posted April 21, 2007 Author Share Posted April 21, 2007 I don't know what's happening - the code seem to be OK ...Do you get any errors when you run the script?Do you have the "beta" version of AotoIt installed? - Opt("GUIOnEventMode", True) works on beta but in order to get it working on other versions you will need to change it to Opt("GUIOnEventMode", 1)There would be the problem, Daddy must have had the Beta version and I just totally ignored that. I love missing blatantly obvious things that even I knew at the start lol. Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now