Page 1 of 1

Child Position Function

Posted: Thu Aug 17, 2006 2:42 am
by Konne
Is there a Function to get the x and y Coordinates of a Child Window by knowing it's x and y values in the Parent?

Posted: Thu Aug 17, 2006 2:52 am
by netmaestro
You mean screen coordinates? So if the parent window was at 200,200 on the screen and the child was at 50,50 on the parent, you'd be looking for the 250,250 ?

Posted: Thu Aug 17, 2006 1:17 pm
by Konne
Exactly

Posted: Thu Aug 17, 2006 6:05 pm
by netmaestro
OK - all you need for the screen coordinates of a window or gadget is to know its window handle. So if you have the child's handle, do:

Code: Select all

GetWindowRect_(hwnd, @var.RECT)
and var\left, var\top will contain the X and Y coordinates on the desktop for the child window.

Posted: Thu Aug 17, 2006 6:51 pm
by Konne
Cool thx

Posted: Thu Aug 17, 2006 7:34 pm
by Bonne_den_kule
What about GadgetX/Y and WindowX/Y ?

Posted: Thu Aug 17, 2006 7:36 pm
by netmaestro
That's fine for native PB stuff but Konne's been doing a lot of API stuff lately, which is why I answered as I did.

Posted: Thu Aug 17, 2006 7:46 pm
by Bonne_den_kule
netmaestro wrote:That's fine for native PB stuff but Konne's been doing a lot of API stuff lately, which is why I answered as I did.
Well, native PB is better then API anyway.

Posted: Thu Aug 17, 2006 9:27 pm
by Konne
Bonne_den_kule wrote:
netmaestro wrote:That's fine for native PB stuff but Konne's been doing a lot of API stuff lately, which is why I answered as I did.
Well, native PB is better then API anyway.
Not at all!
And Windowx etc doesn't work for Gadgets.

Posted: Thu Aug 17, 2006 10:08 pm
by WishMaster
But GadgetX() does ;)

Posted: Thu Aug 17, 2006 10:12 pm
by Konne
But not on the screen.