Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding a control's absolute Left or Top 1

Status
Not open for further replies.

Mike Lewis

Programmer
Jan 10, 2003
17,516
Scotland
Does anyone know of a clever way of finding the position of a control relative to the outer VFP window (_SCREEN).

The Left and Top properties are relative to the control's container. I need to know the position of the control within the screen.

I can get this by looping upward through the containership hierarchy, but I was wondering if anyone can suggest a simpler way.

Why do I need this? Because I want to display a custom help form just below the contol to which it relates.

Thanks in advance.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Hi Mike.

Does anyone know of a clever way of finding the position of a control relative to the outer VFP window (_SCREEN).

How about

Code:
lnTop = OBJTOCLIENT( Thisform, 1 ) + OBJTOCLIENT( This, 1 ) + This.Height + ;
              IIF( Thisform.TitleBar = 1, SYSMETRIC( 9 ) + 2, 2 )
lnLeft = OBJTOCLIENT( Thisform, 2 ) + OBJTOCLIENT( This, 2 )

Marcia G. Akins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top