sias Posted March 28, 2009 Share Posted March 28, 2009 Maybe I don't understand how Child GUIs work, but what I have is a main GUI, and when a button is pressed it brings up a child GUI, in which information is held, also within that child GUI is a button to return the user back to the main GUI (a close button if you will). All this I have made successfully, the problem I am running into is when I close the Child GUI - whether it is destroying it completely or just hiding it - It disables all the controls in my Main GUI. Is this an issue with multi-threading, or am I just incorrectly handling my child and main GUI? Any and all help is greatly appreciated as always, and an example script is just below. #include <GUIConstants.au3> $maingui = GUICreate("Main Gui", 200, 100, -1, -1) $button1 = GUICtrlCreateButton("Click Here", 10, 10, 75, 25) $Exit = GUICtrlCreateButton("Exit", 10, 50, 75, 25) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Exit Exit Case $msg = $button1 $childgui = GUICreate("Child GUI", 200, 100, 50, 50) $button2 = GUICtrlCreateButton("Click Here", 10, 10, 75, 25) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $button2 GUISetState(@SW_ENABLE, $maingui) GUIDelete($childgui) EndSelect WEnd EndSelect WEnd "The true measure of a man is how he treats someone who can do him absolutely no good." Link to comment Share on other sites More sharing options...
Yashied Posted March 28, 2009 Share Posted March 28, 2009 Maybe I don't understand how Child GUIs work, but what I have is a main GUI, and when a button is pressed it brings up a child GUI, in which information is held, also within that child GUI is a button to return the user back to the main GUI (a close button if you will). All this I have made successfully, the problem I am running into is when I close the Child GUI - whether it is destroying it completely or just hiding it - It disables all the controls in my Main GUI. Is this an issue with multi-threading, or am I just incorrectly handling my child and main GUI? Any and all help is greatly appreciated as always, and an example script is just below. expandcollapse popup#include <GUIConstants.au3> $maingui = GUICreate("Main Gui", 200, 100, -1, -1) $button1 = GUICtrlCreateButton("Click Here", 10, 10, 75, 25) $Exit = GUICtrlCreateButton("Exit", 10, 50, 75, 25) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Exit Exit Case $msg = $button1 $childgui = GUICreate("Child GUI", 200, 100, 50, 50) $button2 = GUICtrlCreateButton("Click Here", 10, 10, 75, 25) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $button2 GUISetState(@SW_ENABLE, $maingui) GUIDelete($childgui) EndSelect WEnd EndSelect WEndoÝ÷ Ûú®¢×ºÚ"µÍÚ[ÛYH ÑÕRPÛÛÝ[Ë]LÉÝÂÌÍÛXZ[ÝZHHÕRPÜX]J ][ÝÓXZ[ÝZI][ÝËLLKLJBÌÍØ]ÛHHÕRPÝÜX]P]Û ][ÝÐÛXÚÈI][ÝËLL ÍKJBÌÍÑ^]HÕRPÝÜX]P]Û ][ÝÑ^] ][ÝËL L ÍKJBÕRTÙ]Ý]J BÚ[HB ÌÍÛÙÈHÕRQÙ]ÙÊ BÙ[XÝØÙH ÌÍÛÙÈH ÌÍÑÕRWÑUSÐÓÔÑB^]ØÙH ÌÍÛÙÈH ÌÍÑ^]^]ØÙH ÌÍÛÙÈH ÌÍØ]ÛBBBQÕRTÙ]Ý]JÕ×ÑTÐPK ÌÍÛXZ[ÝZJB ÌÍØÚ[ÝZHHÕRPÜX]J ][ÝÐÚ[ÕRI][ÝËL L LLK ÌÍÛXZ[ÝZJB ÌÍØ]ÛHÕRPÝÜX]P]Û ][ÝÐÛXÚÈI][ÝËLL ÍKJBÕRTÙ]Ý]J BÚ[HB ÌÍÛÙÈHÕRQÙ]ÙÊ BÙ[XÝØÙH ÌÍÛÙÈH ÌÍÑÕRWÑUSÐÓÔÑB^]ØÙH ÌÍÛÙÈH ÌÍØ]ÛÕRTÙ]Ý]JÕ×ÑSPK ÌÍÛXZ[ÝZJBÕRQ[]J ÌÍØÚ[ÝZJBBBBBBY^]ÛÜ[Ù[XÝÑ[[Ù[XÝÑ[ My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
sias Posted March 28, 2009 Author Share Posted March 28, 2009 Thanks for the quick reply, and the working example Yashied! "The true measure of a man is how he treats someone who can do him absolutely no good." Link to comment Share on other sites More sharing options...
BrettF Posted March 28, 2009 Share Posted March 28, 2009 Alternative. #include <WindowsConstants.au3> $hParent = GUICreate ("GUI Parent!", 800, 600, Default, Default, BitOR ($GUI_SS_DEFAULT_GUI , $WS_CLIPCHILDREN)) $hButton1 = GUICtrlCreateButton ("Button", 300, 20) $hChild = GUICreate ("Child", 200, 500, 10, 10, Default, BitOR ($WS_EX_MDICHILD, $WS_EX_TOOLWINDOW), $hParent) GUISetState (@SW_SHOW, $hParent) GUISetState (@SW_SHOW, $hChild) While 1 $nMsg = GUIGetMsg (1) Switch $nMsg[1] Case $hParent;Message is parent GUI Switch $nMsg[0] Case -3 Exit Case $hButton1 MsgBox (0, "", "WOO") EndSwitch Case $hChild Switch $nMsg[0] Case -3 GUISetState (@SW_HIDE, $hChild) Sleep (2000) Exit EndSwitch EndSwitch WEnd Please excuse the window styles which are probably wrong... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
plarmuseau Posted December 7, 2009 Share Posted December 7, 2009 expandcollapse popup#include <WindowsConstants.au3> $hParent = GUICreate ("GUI Parent!", 800, 600, Default, Default, BitOR ($GUI_SS_DEFAULT_GUI , $WS_CLIPCHILDREN)) $hButtonP1 = GUICtrlCreateButton ("Pop", 300, 20) $hButtonP2 = GUICtrlCreateButton ("Child", 300, 50) $hButtonP3 = GUICtrlCreateButton ("Child2", 300, 70) $hChild = GUICreate ("Child", 200, 500, 10, 10, Default, BitOR ($WS_EX_MDICHILD, $WS_EX_TOOLWINDOW), $hParent) $hButtonC1 = GUICtrlCreateButton ("Pop", 20, 20) $hChild2 = GUICreate ("Child", 250, 300, 400, 10, Default, BitOR ($WS_EX_MDICHILD, $WS_EX_TOOLWINDOW), $hParent) $hButtonCo1 = GUICtrlCreateButton ("Pop", 20, 20) GUISetState (@SW_SHOW, $hParent) GUISetState (@SW_SHOW, $hChild) GUISetState (@SW_SHOW, $hChild2) While 1 $nMsg = GUIGetMsg (1) Switch $nMsg[1] Case $hParent;Message is parent GUI Switch $nMsg[0] Case -3 Exit Case $hButtonP1 MsgBox (0, "", "Parent control") Case $hButtonP2 GUISetState (@SW_SHOW, $hChild) Case $hButtonP3 GUISetState (@SW_SHOW, $hChild2) EndSwitch Case $hChild Switch $nMsg[0] Case -3 GUISetState (@SW_HIDE, $hChild) Case $hButtonC1 MsgBox (0, "", "Child control") EndSwitch Case $hChild2 Switch $nMsg[0] Case -3 GUISetState (@SW_HIDE, $hChild2) Case $hButtonCo1 MsgBox (0, "", "Child2 control") EndSwitch EndSwitch WEndNow i got it... 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