jfcby Posted January 13, 2010 Posted January 13, 2010 (edited) Hi, I'm trying to modify a script that I found in this forum. When I try to run the child gui for a second time it will not show. Why want the child gui show when I try to run it for the second time? expandcollapse popup#include <GuiConstantsEx.au3> #include <EditConstants.au3> #include <GuiEdit.au3> #include <WindowsConstants.au3> #include <array.au3> #include <GuiListBox.au3> #include <StaticConstants.au3> Global $msg $hWidth = 395 $hHeight = 425 $hLeft = $hWidth / 2 $hTop = $hHeight / 2 $hGUI = GUICreate("Main GUI", $hWidth, $hHeight, (@DesktopWidth / 2) - $hLeft, (@DesktopHeight / 2) - $hTop) $Label1 = GUICtrlCreateLabel("Label 1", 5, 1, 100, 15) GUICtrlSetFont(-1, 9, 600) $Edit1 = GUICtrlCreateEdit("Edit control.", 5, 25, 385, 350, _ BitOR($ES_AUTOVSCROLL, $ES_MULTILINE, $ES_NOHIDESEL, $ES_WANTRETURN)) $Button1 = GUICtrlCreateButton("Run cGUI", 325, 380) GUISetState(@SW_SHOW) ;Create ChildGUI & Center in Main GUI: parent width/2 minus the child's width/2 $cWidth = 250 $cHeight = 250 $cLeft = $hWidth / 2 - $cWidth / 2 $cTop = $hHeight /2 - $cHeight / 2 $cGUI = GUICreate("Child GUI", $cWidth, $cHeight, $cLeft, $cTop, Default, BitOR($WS_EX_MDICHILD, $WS_EX_TOOLWINDOW), $hGUI) $cLabel1 = GUICtrlCreateLabel("cLabel 1", 5, 5, 75, 20) $cLabel2 = GUICtrlCreateLabel("cLabel 2", 5, 30, 75, 20) $cInput1 = GUICtrlCreateInput("cInput 1", 100, 5, 145, 20) GUICtrlSetState(-1, $GUI_DISABLE) ; the label is in disable state $cInput2 = GUICtrlCreateInput("cInput 2", 100, 30, 145, 20) $cListBox1 = GUICtrlCreateList("cListbox 1", 5, 55, 155, 200) $cButton1 = GUICtrlCreateButton("cButton 1", 170, 65, 75, 20) $cButton2 = GUICtrlCreateButton("cButton 2", 170, 85, 75, 20) $cButton3 = GUICtrlCreateButton("cButton 3", 170, 225, 75, 20) GUISetState(@SW_HIDE) While 1 $Msg = GUIGetMsg() Select Case $Msg = $GUI_EVENT_CLOSE Exit Case $Msg = $Button1 ; Show the child GUISetState(@SW_SHOW, $cGUI) While 1 $aMsg = GUIGetMsg(1) If $aMsg[1] = $cGUI Then ; Check we are getting messages from the child Switch $aMsg[0] Case $GUI_EVENT_CLOSE, $cButton3 GUIDelete($cGUI) ExitLoop Case $cButton1 ; Replace MsgBox(0, "Debug:", "Button Replace!") Case $cButton2 ; Ignore MsgBox(0, "Debug:", "Button Ignore!") EndSwitch EndIf WEnd EndSelect WEnd Thank you for your help, jfcby Edited January 13, 2010 by jfcby Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB ****
Moderators Melba23 Posted January 13, 2010 Moderators Posted January 13, 2010 jfcby,Perhaps if you just hid the child when you exited, rather than deleting it? Case $GUI_EVENT_CLOSE, $cButton3 GUISetState(@SW_HIDE, $cGUI); GUIDelete($cGUI) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ExitLoopM23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
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