Child Position Function

Windows specific forum
Konne
Enthusiast
Enthusiast
Posts: 434
Joined: Thu May 12, 2005 9:15 pm

Child Position Function

Post 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?
Apart from that Mrs Lincoln, how was the show?
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8452
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post 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 ?
BERESHEIT
Konne
Enthusiast
Enthusiast
Posts: 434
Joined: Thu May 12, 2005 9:15 pm

Post by Konne »

Exactly
Apart from that Mrs Lincoln, how was the show?
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8452
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post 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.
BERESHEIT
Konne
Enthusiast
Enthusiast
Posts: 434
Joined: Thu May 12, 2005 9:15 pm

Post by Konne »

Cool thx
Apart from that Mrs Lincoln, how was the show?
Bonne_den_kule
Addict
Addict
Posts: 841
Joined: Mon Jun 07, 2004 7:10 pm

Post by Bonne_den_kule »

What about GadgetX/Y and WindowX/Y ?
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8452
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post 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.
BERESHEIT
Bonne_den_kule
Addict
Addict
Posts: 841
Joined: Mon Jun 07, 2004 7:10 pm

Post 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.
Konne
Enthusiast
Enthusiast
Posts: 434
Joined: Thu May 12, 2005 9:15 pm

Post 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.
Apart from that Mrs Lincoln, how was the show?
WishMaster
Enthusiast
Enthusiast
Posts: 277
Joined: Fri Jun 17, 2005 7:13 pm
Location: Franconia
Contact:

Post by WishMaster »

But GadgetX() does ;)
Image Image
Konne
Enthusiast
Enthusiast
Posts: 434
Joined: Thu May 12, 2005 9:15 pm

Post by Konne »

But not on the screen.
Apart from that Mrs Lincoln, how was the show?
Post Reply