Jump to content

Children windows?


Recommended Posts

#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]
Link to comment
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
Link to comment
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()
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...