Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

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()