JavaScript_Freek Posted August 3, 2006 Share Posted August 3, 2006 expandcollapse popup; Dan's Menu ; August 2, 2006 #include <GuiConstants.au3> ; GUI GuiCreate("Dan's Main Menu", 400, 400) GuiSetIcon(@SystemDir & "\notepad.exe", 0) ; MENU $filemenu = GuiCtrlCreateMenu ("File") $fileitem = GuiCtrlCreateMenuitem ("Open...",$filemenu) $recentfilesmenu = GuiCtrlCreateMenu ("Recent Files",$filemenu) $separator1 = GuiCtrlCreateMenuitem ("",$filemenu) $exititem = GuiCtrlCreateMenuitem ("Exit",$filemenu) $helpmenu = GuiCtrlCreateMenu ("About") $aboutitem = GuiCtrlCreateMenuitem ("About",$helpmenu) ; TAB GuiCtrlCreateTab(1, 0, 400, 150) GuiCtrlCreateTabItem("Intro") GuiCtrlCreateLabel("Welcome to Dan's Menu Program. " &@crlf &"Of course if you trust me you would be seeing this right now." &@crlf &"So hats off you too. So, this is like my first favorite program I wrote. Sweet eh? Well not really, but I still like it!", 20, 40) GuiCtrlCreateTabItem("Test") GuiCtrlCreateLabel("I'm like testing.", 20, 40) GuiCtrlCreateTabItem("About") ; GUI MESSAGE LOOP GuiSetState() While 1 $msg = GUIGetMsg() Select Case $msg = $fileitem $file = FileOpenDialog("Choose file...",@TempDir,"All (*.*)") If @error <> 1 Then GuiCtrlCreateMenuItem ($file,$recentfilesmenu) Case $msg = $exititem ExitLoop Case $msg = $aboutitem Msgbox(0,"About Dan's Menu","This menu was programmed by Dan. This is copyrighted so if you have the same exact code and you claim as yours. Well then your ripping. Got questions? Email me at dan@zetastyles.com!") Case $msg = $GUI_EVENT_CLOSE MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting...") EndSelect WEnd When I click the red X top right of it It will not close. Please help. [center]Cookyx.com :: Simple LAN Chat[/center] Link to comment Share on other sites More sharing options...
MHz Posted August 3, 2006 Share Posted August 3, 2006 Did you search the Gui Forum first as this is Gui stuff? Now, just add an Exit after your MsgBox to quit the script. Link to comment Share on other sites More sharing options...
JavaScript_Freek Posted August 4, 2006 Author Share Posted August 4, 2006 Did you search the Gui Forum first as this is Gui stuff? Now, just add an Exit after your MsgBox to quit the script. How I tried the $GUI_blah close thing but it didnt work.Tell me the script. [center]Cookyx.com :: Simple LAN Chat[/center] Link to comment Share on other sites More sharing options...
John Posted August 4, 2006 Share Posted August 4, 2006 Case $msg = $GUI_EVENT_CLOSE MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting...") Exit EndSelect WEnd Notice the added "Exit" above? That is what MHz said to add Link to comment Share on other sites More sharing options...
rush4hire Posted August 4, 2006 Share Posted August 4, 2006 I've had that happen before. I don't know what causes it. Can you get anything to happen when you get that $msg ? Does 'Exit' work ? Decompilable game code manager for Dark Deeds 6 for Warcraft IIIA web broadcast TiVo like thing.. (this example is for 3abn.org)Finally.. AutoIt Pac-Man Digital Hymn Player Link to comment Share on other sites More sharing options...
MHz Posted August 4, 2006 Share Posted August 4, 2006 @John, thanks, that is what I stated.I've had that happen before. I don't know what causes it.Can you get anything to happen when you get that $msg ?Yes, it shows a msgbox in the first script. A msgBox is not going to close the script though. This is why we have an Exit keyword so we can finish the script conditionally. Or even use ExitLoop if you want to continue down the script. With Exitloop You may use GUIDelete() to close the Gui to continue on with the script.Does 'Exit' work ?Ofcourse Exit works. Link to comment Share on other sites More sharing options...
dandymcgee Posted August 8, 2006 Share Posted August 8, 2006 Here is the whole script. (took me a whole 6 seconds to figure this out) expandcollapse popup; Dan's Menu ; August 2, 2006 #include <GuiConstants.au3> ; GUI GuiCreate("Dan's Main Menu", 400, 400) GuiSetIcon(@SystemDir & "\notepad.exe", 0) ; MENU $filemenu = GuiCtrlCreateMenu ("File") $fileitem = GuiCtrlCreateMenuitem ("Open...",$filemenu) $recentfilesmenu = GuiCtrlCreateMenu ("Recent Files",$filemenu) $separator1 = GuiCtrlCreateMenuitem ("",$filemenu) $exititem = GuiCtrlCreateMenuitem ("Exit",$filemenu) $helpmenu = GuiCtrlCreateMenu ("About") $aboutitem = GuiCtrlCreateMenuitem ("About",$helpmenu) ; TAB GuiCtrlCreateTab(1, 0, 400, 150) GuiCtrlCreateTabItem("Intro") GuiCtrlCreateLabel("Welcome to Dan's Menu Program. " &@crlf &"Of course if you trust me you would be seeing this right now." &@crlf &"So hats off you too. So, this is like my first favorite program I wrote. Sweet eh? Well not really, but I still like it!", 20, 40) GuiCtrlCreateTabItem("Test") GuiCtrlCreateLabel("I'm like testing.", 20, 40) GuiCtrlCreateTabItem("About") ; GUI MESSAGE LOOP GuiSetState() While 1 $msg = GUIGetMsg() Select Case $msg = $fileitem $file = FileOpenDialog("Choose file...",@TempDir,"All (*.*)") If @error <> 1 Then GuiCtrlCreateMenuItem ($file,$recentfilesmenu) Case $msg = $exititem ExitLoop Case $msg = $aboutitem Msgbox(0,"About Dan's Menu","This menu was programmed by Dan. This is copyrighted so if you have the same exact code and you claim as yours. Well then your ripping. Got questions? Email me at dan@zetastyles.com!") Case $msg = $GUI_EVENT_CLOSE MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting...") Exit EndSelect WEnd Enjoy! - Dan [Website] 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