Sign in to follow this  
Followers 0
Achilles

Children windows?

5 posts in this topic

#include <GUIConstants.au3>

$gui = GuiCreate('This is the parent window', 500, 500) 

GuiSetState()

GuiCreate('This is the child window', 400,400, -1, -1, $WS_CLIPCHILDREN, $WS_EX_MDICHILD, $gui)

GuiSetState()

While 1 
    If GuiGetMsg() = -3 then Exit
WEnd

This isn't working for me... I need the child window to be dragged within the main GUI but what's happening now is the Child gui is getting all messed up when I drag the Main window...


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites



I did this but yeh it's totally messed up, could be a bug.

#include <GUIConstants.au3>
Opt("GUIOnEventMode",1)
Global $Inuse=False ,$child
$gui = GuiCreate('This is the parent window', 500, 500)
$button=GUICtrlCreateButton("Make Child",-1,-1,100,100)
GUICtrlSetOnEvent($button,"_Makechild")
GUISetOnEvent($GUI_EVENT_CLOSE,"Quit")
GuiSetState()

While 1
    Sleep(1000)
WEnd
Func _Makechild()
    If $Inuse=True Then Return
    $Inuse=Not $Inuse
    $child=GuiCreate('This is the child window', 400,400, -1, -1,$WS_CLIPCHILDREN, $WS_EX_MDICHILD, $gui)
    GUISetOnEvent($GUI_EVENT_CLOSE,"Subdel")
    GUISetState()
EndFunc
Func Subdel()
    $Inuse=Not $Inuse
    GUIDelete($child)
EndFunc
Func Quit()
    Exit
EndFunc

Share this post


Link to post
Share on other sites

Credits Gary.. if you want one with scrollbar look at his scroll udf.

#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)
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
        ConsoleWrite($Child_GUI &' '&WinGetHandle(''))
            Exit
        Case $Btn_Test
            MsgBox(0, "Test", "Hit Button on Child Window")
    EndSwitch
WEnd

Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0