Jump to content

..basic GUI help


Recommended Posts

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

  • Moderators

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

Check it.. I C+P'd that into my script... and it stopped working again :shocked:. 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

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

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. :shocked: I love missing blatantly obvious things that even I knew at the start lol.

Thanks!

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