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

This function, new in VFP 7, determines whether Event Tracking includes Windows-level mouse and keyboard events. We’re pretty sure it was added in order to facilitate the new Test Harness.

Usage

cTrackingLevel = SYS( 2801 [, nTrackingLevel ] )

Parameter

Value

Meaning

nTrackingLevel

1

Track only VFP events.

2

Track only Windows mouse and keyboard events.

3

Track both VFP events and Windows mouse and keyboard events.

The Event Tracking tool in the Debugger produces a log of the events that fire within VFP. Until VFP 7, the tool could only log VFP’s events. Now, it has the capability to log some Windows events as well—specifically, those related to the mouse (MouseMove, MouseUp and MouseDown) and the keyboard (KeyPress). Although the Windows events have the same names as VFP events, this function isn’t just a way to quickly turn on and off tracking of mouse and keyboard events. When you have both VFP and Windows events tracked, you’ll see two entries for each event that occurs in the VFP window, but Windows events are also tracked in other frames that belong to the VFP window, such as the Debugger frame and the Coverage Profiler. The information provided for Windows events includes the name of the window in which the event occurred.

If you’re controlling Event Tracking programmatically, you need to turn it off and back on (with SET EVENTTRACKING) for changes in this function to take effect.

Be aware that you can’t control which Windows events are tracked, whether you use the list of events in the Event Tracking dialog or SET EVENTLIST. Those techniques affect only VFP events. For Windows events, you track them all or you track none of them.

The Test Harness application clearly uses this ability, as you can see by examining the actual script generated for any test, or the source code for the Test Harness in the Test directory.

Example

cOldTracking = SYS(2801)
* Turn on tracking of Windows events
SYS(2801,2)

See Also

Set EventList, Set EventTracking, Sys() Functions