russell Posted February 27, 2013 Posted February 27, 2013 I wrote a script that makes several GUI's on one i have it set to contuie the script afer 'OK' is pressed. How do i get it to close that GUI and still contiue...i know i cant use exit or the script will terminate. muppet hands are so soft :)
kylomas Posted February 27, 2013 Posted February 27, 2013 russell, Use guidelete() And if you are running a message loop in a function then "return" on $gui_event_close instead of exit. kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
russell Posted February 27, 2013 Author Posted February 27, 2013 thank you very much muppet hands are so soft :)
guinness Posted February 27, 2013 Posted February 27, 2013 russell,Use guidelete()And if you are running a message loop in a function then "return" on $gui_event_close instead of exit.kylomasExitLoop is more favourable. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
kylomas Posted February 28, 2013 Posted February 28, 2013 (edited) russell, guiness is quite right. A boilerplate might look like this expandcollapse popup; *** Start added by AutoIt3Wrapper *** #include <GUIConstantsEx.au3> #include <StaticConstants.au3> ; *** End added by AutoIt3Wrapper *** #AutoIt3Wrapper_Add_Constants=n ;------------------------------------------------------------------------------------------------ ; Main GUI ;------------------------------------------------------------------------------------------------ local $gui010 = guicreate('Primary Gui') local $aSize10 = wingetclientsize($gui010) local $lbl010 = guictrlcreatelabel('Click on me for Secondary Gui',0,20,$aSize10[0],50,bitor($ss_sunken,$ss_center)) guictrlsetfont(-1,16,600) guisetstate() while 1 switch guigetmsg() case $gui_event_close Exit case $lbl010 _MyFunc() EndSwitch WEnd ;------------------------------------------------------------------------------------------------ ; Secondary GUI ;------------------------------------------------------------------------------------------------ func _MyFunc() local $gui020 = guicreate('Secondary Gui',500,200) local $aSize20 = wingetclientsize($gui020) local $lbl020 = guictrlcreatelabel('My Secondary Gui',20,20,$aSize20[0]-40,50,bitor($ss_sunken,$ss_center)) guictrlsetfont(-1,12,800,default,'Comic Sans Serif') guisetstate() while 1 switch guigetmsg() case $gui_event_close guidelete($gui020) Exitloop EndSwitch WEnd Return endfunc kylomas edit: corrected spacing Edited February 28, 2013 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
Amathian Posted March 1, 2013 Posted March 1, 2013 (edited) If you run into the problem, as I did, where you would have to click the Exit button multiple times when using GUIDelete(), change While 1 to While $msg <> $GUI_EVENT_CLOSE It worked for me, not sure if it is the optimal way to do it, though Edited March 1, 2013 by Amathian
kylomas Posted March 1, 2013 Posted March 1, 2013 Amathian, There is something else wrong with your code. Are you issueing guigetmsg() multiple times, a long sleep in the msgloop, a long running function actioned by a control in the msgloop, etc? If you post your code we'll take a look... kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
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