ObjToClient()

The position properties of an object are always relative to the object's container. That is, when you put a text box on a page of a page frame, the text box's Left and Top tell you where it is on that page. Occasionally, what you really want to know is where the object is on the form. That's what OBJTOCLIENT() is all about. You hand it an object and it tells you something about that object with respect to the form that contains it.

Usage

nResult = OBJTOCLIENT( oObject, nMeasurement )

Parameter

Value

Meaning

oObject

Object

The object for which you want to know the position.

nMeasurement

1

Return the top of oObject relative to the form.

2

Return the left edge of oObject relative to the form.

3

Return the width of oObject in pixels.

4

Return the height of oObject in pixels.


The only reason we can see for including height and width here is that OBJTOCLIENT() returns the information in pixels and your form might be using foxels. After all, height and width aren't relative to the container. So why would you want to know this, anyway? Maybe you want to add something to the form at the same position as something else. Or maybe to use the MOUSE command to click on something. You also might use this function to figure out some of the metrics of built-in objects.

Example

? OBJTOCLIENT( ThisForm.PageFrame1.Page1.Checkbox1, 1 )
   * Returns distance in pixels from left edge of form to left 
   * edge of checkbox

See Also

Height, Left, Mouse, ScaleMode, Top, Width


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .