Generator Posted April 23, 2007 Share Posted April 23, 2007 (edited) I came across and found out I need some GUI child win instead of msg box, so now I am wondering. How does child work exactly, I've search through help file and I did not find any clue, do you create another GUI and setstate as hidden? Or there is something else? Thanks in advance. Edit: I posted here because there are way less user browsing GUI forum, so insteading of keep bumping in there I posted it here. Edited April 23, 2007 by Generator Link to comment Share on other sites More sharing options...
Generator Posted April 23, 2007 Author Share Posted April 23, 2007 Bump? Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 24, 2007 Share Posted April 24, 2007 Look in the help file at GuiCreate(). The function returns the handle of GUI being created. If you then create a second GUI while passing the handle from the first, you are creating a CHILD GUI. Handy demo: #include <guiconstants.au3> Opt("GuiOnEventMode", 1) $hGuiParent = GUICreate("Parent GUI", 200, 100, 100, 100) GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit") GUISetState() $hGuiChild = GUICreate("Child GUI", 200, 100, 300, 300, -1, -1, $hGuiParent) GUISetOnEvent($GUI_EVENT_CLOSE, "_Warn") GUISetState() While 1 Sleep(20) WEnd Func _Quit() Exit EndFunc Func _Warn() MsgBox(16, "Warning", "You are closing the window.") GUIDelete($hGuiChild) EndFunc Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Generator Posted April 24, 2007 Author Share Posted April 24, 2007 Look in the help file at GuiCreate(). The function returns the handle of GUI being created. If you then create a second GUI while passing the handle from the first, you are creating a CHILD GUI. Handy demo: #include <guiconstants.au3> Opt("GuiOnEventMode", 1) $hGuiParent = GUICreate("Parent GUI", 200, 100, 100, 100) GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit") GUISetState() $hGuiChild = GUICreate("Child GUI", 200, 100, 300, 300, -1, -1, $hGuiParent) GUISetOnEvent($GUI_EVENT_CLOSE, "_Warn") GUISetState() While 1 Sleep(20) WEnd Func _Quit() Exit EndFunc Func _Warn() MsgBox(16, "Warning", "You are closing the window.") GUIDelete($hGuiChild) EndFunc Thanks, really good example and easy to understand. Link to comment Share on other sites More sharing options...
Generator Posted April 24, 2007 Author Share Posted April 24, 2007 (edited) One more thing. I have a function that creates a child GUI of the main GUI. But if user activiates that function again, it creates and other child GUI which isn't what I wanted. And if so, I can close the new 1 but not the old 1, the old GUI child seems responseless. Anyidea how to fix this? Thanks in Advance. Edit: Problem Solved. Edited April 24, 2007 by Generator 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