Jump to content

GUI Child Window


the123punch
 Share

Recommended Posts

Hi all,

I have a GUI that has a main window from which a child window is created. For the child window, I want to be able to place always close to its parent window (like for example to its right or to its left), so I need to be able to get the top and left positions of the parent window to give it to the child window when I create it.

I also want to have that child window modal when it pops up so that the user has to read it and close it before continuing.

Is there a possibilty to do that in AutoIt? Is there any windows GUI styles that I should be using?

Thanks for the help.

the123punch

Link to comment
Share on other sites

Hi all,

I have a GUI that has a main window from which a child window is created. For the child window, I want to be able to place always close to its parent window (like for example to its right or to its left), so I need to be able to get the top and left positions of the parent window to give it to the child window when I create it.

I also want to have that child window modal when it pops up so that the user has to read it and close it before continuing.

Is there a possibilty to do that in AutoIt? Is there any windows GUI styles that I should be using?

Thanks for the help.

the123punch

wingetpos() in order to find the parent and adjust the child accordingly

[u]You can download my projects at:[/u] Pulsar Software
Link to comment
Share on other sites

here and example:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$hGUI = GUICreate('Main GUI', 400, 300)
$Button = GUICtrlCreateButton('click', 50, 100, 50)
$hPOS = WinGetPos($hGUI)
GUISetState()


While 1
    $Msg = GUIGetMsg()
    If $Msg = $GUI_EVENT_CLOSE Then Exit
    If $Msg = $Button Then
        $hCHILD = GUICreate("Child", 169, 68, $hPOS[0] + $hPOS[2], $hPOS[1], -1, -1, $hGUI)
        GUISetState()
    EndIf
WEnd
Link to comment
Share on other sites

If you want to give your GUI Child the123punch then use this code to keep the child moving with the parent.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $hPOS, $hPOS2
$hGUI = GUICreate('Main GUI', 400, 300)
$Button = GUICtrlCreateButton('click', 50, 100, 50)
$hPOS = WinGetPos($hGUI)
GUISetState()


While 1
    $Msg = GUIGetMsg()
    If $Msg = $GUI_EVENT_CLOSE Then Exit
    Select 
        Case $Msg = $Button
            $hPOS = WinGetPos($hGUI)
            $hCHILD = GUICreate("Child", 169, 68, $hPOS[0] + $hPOS[2], $hPOS[1], -1, -1, $hGUI)
            GUISetState()
        Case $Msg = $GUI_EVENT_PRIMARYUP
            $hPOS2 = WinGetPos($hGUI)
            WinMove($hCHILD,"Child",$hPOS2[0] + $hPOS2[2] , $hPOS2[1])
    EndSelect
WEnd
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...