Jump to content
Sign in to follow this  
ddr4lyfe

WinMove to another window's client coords?

Recommended Posts

ddr4lyfe

I'm trying to move Window1 to the center of Window2 using Window2's size as a reference, something like:

While WinExists ("Window1")

     WinMove ("Window1", "", $Window2Width / 2, $Window2Height / 2)

WEnd

I could just move Window1 by using desktop coordinates, but I'm looking for a nicer solution. Any ideas?

Share this post


Link to post
Share on other sites
somdcomputerguy

Use WinGetPos() to get the size of Window2.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
ddr4lyfe

Use WinGetPos() to get the size of Window2.

 

Oh wait... that would work because it would be grabbing the position using the desktop coords, then would move Window1 to those same desktop coords. So instead of moving Window1's coords using Window2 as a reference, both windows just use the desktop as a reference. Alright, thanks for the help!

Share this post


Link to post
Share on other sites
somdcomputerguy

WinGetPos() returns a 4 element array - window position X & Y, window size width & height. See the Help file for details. The WinGetClientSize() function may be useful instead..

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

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  

×