Jump to content

pop up an info box in the center of a parent gui


tlman12
 Share

Recommended Posts

I'm writing a script and in this script i created a secondary gui that is supposed to pop up while the script is working and go away when it is done

this all works fine but if the user goes to another window and brings the script back up the working message is not visible anymore cause it's not top most (if it was topmost it'd be on top of all windows and i don't want that)

what i think i need is to make it a child of the main gui and have it pop up in the center

it could even be an image that shows on top of all other txt

this is what i'm currently doing with the code

GUISetState(@SW_DISABLE,$Parent)
GUISetState(@SW_SHOW, $child)
_Func1()
$data = StringRight(GUICtrlRead($data5), 4)
If Not $data = "" Then
_Func2($Data)
_Func3($Data)
EndIf
GUISetState(@SW_HIDE, $Child)
GUISetState(@SW_ENABLE,$Parent)

and this is working fine except for the problems i mentioned above.

thanks for your help

Link to comment
Share on other sites

Give your child $WS_EX_MDICHILD in the ExStyle paramater. Heres a sample app but the "pop up" window doesnt have a border but hopefully you get the idea.

Cheers

#include <GuiConstants.au3>
#include <WindowsConstants.au3>

Opt("GUIOnEventMode", 1)

$gui=GUICreate("blah",300,300,300,300)
GUISetState(@SW_SHOW,$gui)
$button = GUICtrlCreateButton("Press",100,100)
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "NewWindow")

While 1
    
Wend


Func NewWindow()
$gui2=GUICreate("child",200,200,150,150,$WS_POPUP,$WS_EX_MDICHILD,$gui)
GUISetState(@SW_SHOW,$gui2)
EndFunc
Link to comment
Share on other sites

@tlman12: That is not how you create a child window. If created it as a proper child it would behave as you want without further intervention:

#include <GuiConstantsEx.au3>

$hParent = GUICreate("Parent", 300, 300)
GUISetState()
$hChild = GuiCreate("Child", 200, 200, -1 , -1, -1, -1, $hParent)
GUISetState()

Do
    Sleep(10)
Until GUIGetMsg() = $GUI_EVENT_CLOSE

:)

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Give your child $WS_EX_MDICHILD in the ExStyle paramater. Heres a sample app but the "pop up" window doesnt have a border but hopefully you get the idea.

Cheers

#include <GuiConstants.au3>
#include <WindowsConstants.au3>

Opt("GUIOnEventMode", 1)

$gui=GUICreate("blah",300,300,300,300)
GUISetState(@SW_SHOW,$gui)
$button = GUICtrlCreateButton("Press",100,100)
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "NewWindow")

While 1
    
Wend


Func NewWindow()
$gui2=GUICreate("child",200,200,150,150,$WS_POPUP,$WS_EX_MDICHILD,$gui)
GUISetState(@SW_SHOW,$gui2)
EndFunc

Thats exactly what i needed :) thank you

@tlman12: That is not how you create a child window. If created it as a proper child it would behave as you want without further intervention:

#include <GuiConstantsEx.au3>

$hParent = GUICreate("Parent", 300, 300)
GUISetState()
$hChild = GuiCreate("Child", 200, 200, -1 , -1, -1, -1, $hParent)
GUISetState()

Do
    Sleep(10)
Until GUIGetMsg() = $GUI_EVENT_CLOSE

:)

after further inspection and closer reading of the help file i did find this about setting the parent window, also a crucial part of getting exactly what i wanted thanks

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...