Sign in to follow this  
Followers 0
Hawkwing

Center a GUI

5 posts in this topic

Simple question, when you create a child GUI, how do you center it over it's parent?


The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Share this post


Link to post
Share on other sites



Getting the parent width/2 minus the child's width/2, same for height. Correct?

Share this post


Link to post
Share on other sites

But then if you can move the parent gui around, then it will put the child gui where the parent started, not where it is now.


The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

So handle the parent WM_MOVE event. You can also check, if the child may not exist always, if $hChild is pointing to an existing window handle, If IsHWnd($hChild) Then move the window.

Edit Maybe using MDI is the proper way to go?

Edited by Authenticity

Share this post


Link to post
Share on other sites

Thanks, I'm not really sure how handle the parent wm_move event, but when I put $WS_EX_MDICHILD in the exStyle section, it worked.


The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

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