Alek Posted May 11, 2007 Share Posted May 11, 2007 is it possible to make a GUI inside a GUI??like this(ish) [font="Impact"]Never fear, I is here.[/font] Link to comment Share on other sites More sharing options...
Helge Posted May 11, 2007 Share Posted May 11, 2007 Search for SetParent. Holger had a post about a while back ago. Link to comment Share on other sites More sharing options...
Alek Posted May 12, 2007 Author Share Posted May 12, 2007 (edited) Search for SetParent. Holger had a post about a while back ago.i found one example with DllCall("user32.dll", "int", "SetParent", "hwnd", WinGetHandle($Child_gui), "hwnd", WinGetHandle($Main_gui)) but it dosent work in the way i want, i want to create a area inside a gui where i can put another gui,and i want to be able to use buttons on the main gui and the other gui. Edited May 12, 2007 by Alek [font="Impact"]Never fear, I is here.[/font] Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 15, 2007 Share Posted May 15, 2007 Hi, something like this? expandcollapse popup;Gui drumrun #include <GUIConstants.au3> #include <Array.au3> HotKeySet("{ESC}", "_end") Global $title = 'Unbenannt - Editor' ; German!!! ;ShellExecute('notepad', '', '', 'open', @SW_SHOW) $PID = Run(@WindowsDir & "\notepad.exe", "", @SW_SHOW) WinWait($title, '', 2) $handle = WinGetHandle($title) WinMove($handle, '', 100, 200, 400, 200) Global $start = WinGetPos($handle) $gui = GUICreate("GUI", $start[2] + 50, $start[3] + 50, $start[0] - 25, $start[1] - 55, Default) $exit_B = GUICtrlCreateButton('Exit', 5, 1, 100, 20) GUISetBkColor(0x00FF00) WinSetTitle($handle, '', 'Megas Notepad :-)') _GUICreateInvRect($gui, 20, 50, $start[2] + 10, $start[3] + 10) GUISetState(@SW_SHOW) ; will display an empty dialog box ;Variables Global $saveGuipos = WinGetPos('GUI') ; Run the GUI until the dialog is closed While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE WinClose($handle) ExitLoop Case $exit_B WinClose($handle) ExitLoop EndSwitch _checkWin() WEnd Func _checkWin() $newGUIpos = WinGetPos('GUI') $p1 = _ArrayToString($saveGuipos, ',') $p2 = _ArrayToString($newGUIpos, ',') If $p1 <> $p2 Then ConsoleWrite(1 & @CRLF) WinMove($handle, '', $newGUIpos[0] + 25, $newGUIpos[1] + 55) $saveGuipos = $newGUIpos EndIf EndFunc ;==>_checkWin Func _GUICreateInvRect($hwnd, $l, $t, $w, $h) $pos = WinGetPos($hwnd) $1 = 0 $2 = 0 $3 = $pos[2] $4 = $t $ret = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $1, "long", $2, "long", $3, "long", $4) $1 = 0 $2 = 0 $3 = $l $4 = $pos[3] $ret2 = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $1, "long", $2, "long", $3, "long", $4) $1 = $l + $w $2 = 0 $3 = $pos[2] $4 = $pos[3] $ret3 = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $1, "long", $2, "long", $3, "long", $4) $1 = 0 $2 = $t + $h $3 = $pos[2] $4 = $pos[3] $ret4 = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $1, "long", $2, "long", $3, "long", $4) DllCall("gdi32.dll", "long", "CombineRgn", "long", $ret[0], "long", $ret[0], "long", $ret2[0], "int", 2) DllCall("gdi32.dll", "long", "CombineRgn", "long", $ret[0], "long", $ret[0], "long", $ret3[0], "int", 2) DllCall("gdi32.dll", "long", "CombineRgn", "long", $ret[0], "long", $ret[0], "long", $ret4[0], "int", 2) DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hwnd, "long", $ret[0], "int", 1) EndFunc ;==>_GUICreateInvRect Func _end() Exit (0) EndFunc ;==>_end So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
GaryFrost Posted May 15, 2007 Share Posted May 15, 2007 Seems like SetParent is what you need to do. #include <GuiConstants.au3> $Main_GUI = GUICreate("Main") $Btn_Exit = GUICtrlCreateButton("E&xit", 10, 10, 90, 20) GUISetState(@SW_SHOW, $Main_GUI) $Child_GUI = GUICreate("Child", 200, 100, 10, 50, $WS_CAPTION) GUISetBkColor(0xfffaf0, $Child_GUI) $Btn_Test = GUICtrlCreateButton("Test", 10, 10, 90, 20) GUISetState(@SW_SHOW, $Child_GUI) DllCall("user32.dll", "int", "SetParent", "hwnd", WinGetHandle($Child_GUI), "hwnd", WinGetHandle($Main_GUI)) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $Btn_Exit Exit Case $Btn_Test MsgBox(0, "Test", "Hit Button on Child Window") EndSwitch WEnd Skeletor 1 SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
GaryFrost Posted May 15, 2007 Share Posted May 15, 2007 Make it look a little more like your (ish) #include <GuiConstants.au3> $Main_GUI = GUICreate("Main", 500, 500) GUISetBkColor(0xfffaf0, $Main_GUI) GUISetState(@SW_SHOW, $Main_GUI) $Child1_GUI = GUICreate("Child", 480, 480, 10, 10, $WS_CHILD, -1, $Main_GUI) $Btn_Exit = GUICtrlCreateButton("E&xit", 10, 10, 90, 20) GUISetState(@SW_SHOW, $Child1_GUI) $Child2_GUI = GUICreate("Child", 200, 100, 10, 50, $WS_CAPTION) GUISetBkColor(0xfffaf0, $Child2_GUI) $Btn_Test = GUICtrlCreateButton("Test", 10, 10, 90, 20) GUISetState(@SW_SHOW, $Child2_GUI) DllCall("user32.dll", "int", "SetParent", "hwnd", WinGetHandle($Child2_GUI), "hwnd", WinGetHandle($Child1_GUI)) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $Btn_Exit Exit Case $Btn_Test MsgBox(0, "Test", "Hit Button on Child Window") EndSwitch WEnd fopetesl 1 SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
WeMartiansAreFriendly Posted May 16, 2007 Share Posted May 16, 2007 Make it look a little more like your (ish) #include <GuiConstants.au3> $Main_GUI = GUICreate("Main", 500, 500) GUISetBkColor(0xfffaf0, $Main_GUI) GUISetState(@SW_SHOW, $Main_GUI) $Child1_GUI = GUICreate("Child", 480, 480, 10, 10, $WS_CHILD, -1, $Main_GUI) $Btn_Exit = GUICtrlCreateButton("E&xit", 10, 10, 90, 20) GUISetState(@SW_SHOW, $Child1_GUI) $Child2_GUI = GUICreate("Child", 200, 100, 10, 50, $WS_CAPTION) GUISetBkColor(0xfffaf0, $Child2_GUI) $Btn_Test = GUICtrlCreateButton("Test", 10, 10, 90, 20) GUISetState(@SW_SHOW, $Child2_GUI) DllCall("user32.dll", "int", "SetParent", "hwnd", WinGetHandle($Child2_GUI), "hwnd", WinGetHandle($Child1_GUI)) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $Btn_Exit Exit Case $Btn_Test MsgBox(0, "Test", "Hit Button on Child Window") EndSwitch WEnd thats really clever. Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet() Link to comment Share on other sites More sharing options...
fopetesl Posted March 1, 2017 Share Posted March 1, 2017 On 15/05/2007 at 11:49 PM, GaryFrost said: Make it look a little more like your (ish) #include <GuiConstants.au3> $Main_GUI = GUICreate("Main", 500, 500) GUISetBkColor(0xfffaf0, $Main_GUI) GUISetState(@SW_SHOW, $Main_GUI) $Child1_GUI = GUICreate("Child", 480, 480, 10, 10, $WS_CHILD, -1, $Main_GUI) $Btn_Exit = GUICtrlCreateButton("E&xit", 10, 10, 90, 20) GUISetState(@SW_SHOW, $Child1_GUI) $Child2_GUI = GUICreate("Child", 200, 100, 10, 50, $WS_CAPTION) GUISetBkColor(0xfffaf0, $Child2_GUI) $Btn_Test = GUICtrlCreateButton("Test", 10, 10, 90, 20) GUISetState(@SW_SHOW, $Child2_GUI) DllCall("user32.dll", "int", "SetParent", "hwnd", WinGetHandle($Child2_GUI), "hwnd", WinGetHandle($Child1_GUI)) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $Btn_Exit Exit Case $Btn_Test MsgBox(0, "Test", "Hit Button on Child Window") EndSwitch WEnd Great But how is child positioned in Main GUI? Before the DLL call the child is placed outside of Main GUI. I have the need to place several children inside the Main GUI so need to place accurately. Spined 1 The most powerful number in the Universe. Zero. 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