Sys(1270)

This function gives you a reference to the object located at either the mouse position or a specified position. The way you specify positions, however, is fairly ridiculous.

Usage

uObject = SYS( 1270 [, nXCoord, nYCoord ] )

Parameter

Value

Meaning

nXCoord, nYCoord

Numeric

The position for which you want an object reference.

Omitted

Return a reference to the object under the mouse pointer.

uObject

Object

A reference to the object at the current or specified position.

.F.

No object was found at the current or specified position.


SYS(1270) is a lot like ASelObj(), except that it doesn't require you to actually click on anything—you can just grab whatever's under the mouse pointer. Like so many SYS() functions before it, once Microsoft realized that this one is really useful, in VFP 6 they gave us a new and improved version—check out AMouseObj().If you omit the parameters, this function works as advertised. It gives you a reference to the object the mouse is over. This is especially handy for debugging.

When you pass the optional coordinates, they're measured from the upper-left corner of your screen. That's right, not the VFP main window, but the screen itself. So, if you move VFP, you have to change the parameters to this function. We can't think of any reason why this function is interested in the outside world since it can't give us information about what's out there.


We're also baffled as to why the function has two different return types. Why not return .NULL. when there's no object there? Having an object reference in one case and .F. in the other makes it a pain to write code that uses the function. We have to check VarType() of the return value before we do anything.

Example

oCurrent = SYS(1270)
 
* A lot of people set up something like this to make debugging
* easier. The second line is needed so forms will close.
ON KEY LABEL F11 o = SYS(1270)
ON KEY LABEL F12 o = .null.

See Also

AMouseObj(), ASelObj(), MCol(), Mouse, MRow(), VarType()


Back to Table of Contents

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