hiho Posted May 21, 2013 Share Posted May 21, 2013 (edited) expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ComboConstants.au3> #include <Array.au3> #include <EditConstants.au3> #include <WinHttp.au3> #include <IE.au3> Global $hGUI2 = 9999, $hGUI1 = 9999, $hGUI3 = 9999, $hGUI4 = 9999, $hGUI = 9999, $bGetDescr = 9999, $bPic = 9999, $bOpisanie = 9999, $bUpload = 9999 Global $descr_gt $hGUI = GUICreate("G-U-I", 205, 105) GUICtrlCreateGroup("Details", 2, 2, "", 75) GUICtrlCreateLabel("1", 7, 21) GUICtrlCreateLabel("2", 7, 46) $u = GUICtrlCreateInput("", 50, 20, 145, "", $ES_WANTRETURN) $p = GUICtrlCreateInput("", 50, 45, "", "", $ES_PASSWORD + $ES_WANTRETURN) $ok = GUICtrlCreateButton("ОК", 4, 80, 196, 22) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg(1) Switch $msg[1] Case $hGUI Switch $msg[0] Case $ok If GUICtrlRead($u) = "" Or GUICtrlRead($p) = "" Then MsgBox(16, "My GUI", "empty field") Else $username = GUICtrlRead($u) $pw = GUICtrlRead($p) GUIDelete() Upload() EndIf Case $GUI_EVENT_CLOSE Exit EndSwitch Case $hGUI2 Switch $msg[0] Case $GUI_EVENT_CLOSE GUIDelete() Case $bPic Pic() EndSwitch Case $hGUI3 Switch $msg[0] Case $GUI_EVENT_CLOSE GUIDelete() EndSwitch Case $hGUI4 Switch $msg[0] Case $GUI_EVENT_CLOSE Exit Case $descr_gt Opisanie() ;~ Pic() EndSwitch EndSwitch WEnd GUIDelete() Func Opisanie() $hGUI2 = GUICreate("GUI", 680, 600); will create a dialog box that when displayed is centered $bPic = GUICtrlCreateButton("Press Me", 450, 555, 170, 26) GUICtrlCreateTab(10, 10, 666, 585) GUISetState(@SW_SHOW) EndFunc ;==>Opisanie Func Pic() $hGUI3 = GUICreate("MyGUI", 380, 180) GUISetState(@SW_SHOW) EndFunc ;==>Pic Func Pic2() MsgBox(0, "", "pic2") EndFunc ;==>Pic2 Func Upload() $hGUI4 = GUICreate("TEST", 500, 520) $descr_gt = GUICtrlCreateButton("Направи", 9, 304, 55, 23) GUISetState(@SW_SHOW) EndFunc ;==>Upload Hi guys, this is my code (+/- 1500 lines ). As you can see, when I run it, it'll show a GUI with 2 input boxes, then you have a small button which calls a makes a 2nd GUI and there is a button which makes a 3rd GUI. However when I open the 3rd GUI,I can't close - even if the second one is closed (delete). Is this a normal behaviour? Edited May 21, 2013 by hiho Link to comment Share on other sites More sharing options...
Solution BrewManNH Posted May 21, 2013 Solution Share Posted May 21, 2013 You're referencing the wrong GUIs in your button codes. GUI 1 opens GUI 4, GUI 4 opens GUI 2, GUI 2 opens GUI 3 but your GUIDelete only deletes GUI 3 because you don't reference the handle for the right GUI, you just reference the last created GUI. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
hiho Posted May 21, 2013 Author Share Posted May 21, 2013 Oh, I see. I didn't realise I had to point which GUI has to be deleted in GUIDelete(). Thanks, buddy. 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