Zisly Posted March 29, 2008 Posted March 29, 2008 I need help with a thing How do i put so if i click on one button something will happends? What wrong with the code? dont say nothing is wrong because thats not true,it just wont work :/ Ex case.. Case $Button6 MsgBox(1 ,"Hello","Hello") Full code. #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form=Bot load.kxf\Bot load.kxf $Form2 = GUICreate("Ztb", 602, 354, 180, 109) $Pic1 = GUICtrlCreatePic("C:\Documents and Settings\omnibook\Skrivbord\zbot.bmp", -16, 0, 617, 353, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) $Button1 = GUICtrlCreateButton("&Afk Tools", 32, 72, 75, 25, 0) GUICtrlSetState(-1, $GUI_HIDE) $Button2 = GUICtrlCreateButton("&Rune Making", 32, 112, 75, 25, 0) GUICtrlSetState(-1, $GUI_HIDE) $Button3 = GUICtrlCreateButton("&Alarms", 32, 160, 75, 25, 0) GUICtrlSetState(-1, $GUI_HIDE) $Button4 = GUICtrlCreateButton("&Shortcuts", 32, 200, 75, 25, 0) GUICtrlSetState(-1, $GUI_HIDE) $Button5 = GUICtrlCreateButton("&Scripts", 32, 240, 75, 25, 0) GUICtrlSetState(-1, $GUI_HIDE) $Button6 = GUICtrlCreateButton("&Help", 488, 48, 75, 41, 0) GUICtrlSetState(-1, $GUI_HIDE) $Edit1 = GUICtrlCreateEdit("", 464, 104, 97, 81, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_READONLY,$ES_WANTRETURN,$WS_BORDER), BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE)) GUICtrlSetData(-1, StringFormat("READ!\r\nNote that is bot is\r\njust in beta so\r\nbugs and errors\r\nmay/can occur.\r\n")) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Button6 MsgBox(1 ,"Hello","Hello") Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Whats wrong? sad.gif
PumpkinJuice Posted March 29, 2008 Posted March 29, 2008 Its right here: Msgbox(1, "Hello", "Hello") Look in the helpfile for the correct Msgbox flags! My name is Leilani Swaey! :)
monoceres Posted March 29, 2008 Posted March 29, 2008 Of course nothing will happen if you use GUICtrlSetState(-1, $GUI_HIDE) on the button, you cannot click it! Broken link? PM me and I'll send you the file!
Zisly Posted March 29, 2008 Author Posted March 29, 2008 Of course nothing will happen if you use GUICtrlSetState(-1, $GUI_HIDE) on the button, you cannot click it!I've already tested to take that away and it didn't work, im gona look in the helpfile for the flags.
cppman Posted March 29, 2008 Posted March 29, 2008 (edited) There's nothing wrong with his MsgBox call. If you want to check if something was pressed in the message box, you need to check the return value.#include <GUIConstants.au3> #Region ### START Koda GUI section ### Form=Bot load.kxf\Bot load.kxf $Form2 = GUICreate("Ztb", 602, 354, 180, 109) ;$Pic1 = GUICtrlCreatePic("C:\Documents and Settings\omnibook\Skrivbord\zbot.bmp", -16, 0, 617, 353, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) $Button1 = GUICtrlCreateButton("&Afk Tools", 32, 72, 75, 25, 0) $Button2 = GUICtrlCreateButton("&Rune Making", 32, 112, 75, 25, 0) $Button3 = GUICtrlCreateButton("&Alarms", 32, 160, 75, 25, 0) $Button4 = GUICtrlCreateButton("&Shortcuts", 32, 200, 75, 25, 0) $Button5 = GUICtrlCreateButton("&Scripts", 32, 240, 75, 25, 0) $Button6 = GUICtrlCreateButton("&Help", 488, 48, 75, 41, 0) $Edit1 = GUICtrlCreateEdit("", 464, 104, 97, 81, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_READONLY,$ES_WANTRETURN,$WS_BORDER), BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE)) GUICtrlSetData(-1, StringFormat("READ!\r\nNote that is bot is\r\njust in beta so\r\nbugs and errors\r\nmay/can occur.\r\n")) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Button6 $ret = MsgBox(1 ,"Hello","Hello") if ($ret == 1) Then MsgBox(0, "", "The user pressed OK") if ($ret == 2) Then MsgBox(0, "", "The user pressed Cancel") Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Edited March 29, 2008 by cppman Miva OS Project
Zisly Posted March 29, 2008 Author Posted March 29, 2008 Thanks! Ok it did work without the picture, but when i have a picture it doesn't work :S
cppman Posted March 29, 2008 Posted March 29, 2008 (edited) You need to disable the background image (Picture control). #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form=Bot load.kxf\Bot load.kxf $Form2 = GUICreate("Ztb", 602, 354, 180, 109) $Pic1 = GUICtrlCreatePic("C:\Documents and Settings\omnibook\Skrivbord\zbot.bmp", -16, 0, 617, 353, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) GUICtrlSetState($Pic1, $GUI_DISABLE) $Button1 = GUICtrlCreateButton("&Afk Tools", 32, 72, 75, 25, 0) $Button2 = GUICtrlCreateButton("&Rune Making", 32, 112, 75, 25, 0) $Button3 = GUICtrlCreateButton("&Alarms", 32, 160, 75, 25, 0) $Button4 = GUICtrlCreateButton("&Shortcuts", 32, 200, 75, 25, 0) $Button5 = GUICtrlCreateButton("&Scripts", 32, 240, 75, 25, 0) $Button6 = GUICtrlCreateButton("&Help", 488, 48, 75, 41, 0) $Edit1 = GUICtrlCreateEdit("", 464, 104, 97, 81, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_READONLY,$ES_WANTRETURN,$WS_BORDER), BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE)) GUICtrlSetData(-1, StringFormat("READ!\r\nNote that is bot is\r\njust in beta so\r\nbugs and errors\r\nmay/can occur.\r\n")) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Button6 $ret = MsgBox(1 ,"Hello","Hello") if ($ret == 1) Then MsgBox(0, "", "The user pressed OK") if ($ret == 2) Then MsgBox(0, "", "The user pressed Cancel") Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Edited March 29, 2008 by cppman Miva OS Project
Zisly Posted March 29, 2008 Author Posted March 29, 2008 (edited) Now it works, thanks for the help Edited March 29, 2008 by Zisly
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