penggilas2 Posted December 4, 2009 Posted December 4, 2009 Create Gui and Call new gui in menu file.. expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> Opt('MustDeclareVars', 1) _Main() Func _Main() Local $filemenu, $fileitem, $recentfilesmenu, $separator1 Local $exititem, $helpmenu, $aboutitem, $okbutton, $cancelbutton Local $msg, $file #forceref $separator1 GUICreate("GUI menu", 300, 200) $filemenu = GUICtrlCreateMenu("File") $fileitem = GUICtrlCreateMenuItem("Open...", $filemenu) $recentfilesmenu = GUICtrlCreateMenu("Recent Files", $filemenu) $separator1 = GUICtrlCreateMenuItem("", $filemenu) $exititem = GUICtrlCreateMenuItem("Exit", $filemenu) $helpmenu = GUICtrlCreateMenu("?") $aboutitem = GUICtrlCreateMenuItem("About", $helpmenu) $okbutton = GUICtrlCreateButton("OK", 50, 130, 70, 20) $cancelbutton = GUICtrlCreateButton("Cancel", 180, 130, 70, 20) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton ExitLoop Case $msg = $fileitem $file = FileOpenDialog("Choose file...", @TempDir, "All (*.*)") If @error <> 1 Then GUICtrlCreateMenuItem($file, $recentfilesmenu) Case $msg = $exititem ExitLoop Case $msg = $okbutton MsgBox(0, "Click", "You clicked OK!") Case $msg = $aboutitem NewGuiss () EndSelect WEnd GUIDelete() Exit EndFunc ;==>_Main Func NewGuiss () Local $gui, $font, $msg $gui = GUICreate("Test", 300, 400) GUISetBkColor(0xE0FFFF) $font = "Comic Sans MS" GUICtrlCreateLabel("...oo00OO Just Learn AutoIt Script OO00oo...", 10, 10, 339, 20) GUICtrlSetFont(-1, 9, 339, 4, $font) GUICtrlSetColor(-1, 0xff0000) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then GUIDelete() WEnd EndFunc Click (?) menu than About, will call new gui.. After close NewGuiss, than call again no response, What wrong..??? And after call Newguiss, Cancel menu in main menu not function..
andygo Posted December 4, 2009 Posted December 4, 2009 change your while-loop in the newguiss() to this: While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then GUIDelete() exitloop endif WEnd
penggilas2 Posted December 4, 2009 Author Posted December 4, 2009 change your while-loop in the newguiss() to this: While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then GUIDelete() exitloop endif WEnd Thank`s....
LWC Posted August 26, 2010 Posted August 26, 2010 But what do you do when Opt("GUIOnEventMode", 1)? You can't use GUIGetMsg and loopexit in that case.
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