Jump to content
Sign in to follow this  
the123punch

GUI Child Window

Recommended Posts

the123punch

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

  • Like 1

Share this post


Link to post
Share on other sites
maqleod

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

  • Like 1

[u]You can download my projects at:[/u] Pulsar Software

Share this post


Link to post
Share on other sites
oMBRa

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
  • Like 1

Share this post


Link to post
Share on other sites
elpresident3

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
  • Like 1

Share this post


Link to post
Share on other sites
the123punch

Thank you all!

Greatly appreciate your help!

Cheers.

the123punch

  • Like 1

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  

×