How to use the SYS(1270) function (141972)



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 3.0b

This article was previously published under Q141972
3.00b WINDOWS kbdocerr kbhowto

SUMMARY

The Visual FoxPro Help file states that the SYS(1270) function returns a reference for an object at the specified point, but it does not give an example of how to use it.

MORE INFORMATION

The return type for the SYS(1270) function is either an Object or Logical. Because it could return an Object, you may receive a Data Type Mismatch error if you type the following a in the Command window:

   ? SYS(1270)
				


If you don't include any coordinates when you issue a SYS(1270), it will use the Mouse Pointer for the coordinates. The SYS(1270) function always returns a Logical False if no object is under the mouse pointer or located at the coordinates specified.

The following example uses a timer to call the SYS(1270) function and then increment a counter any time the mouse pointer isn't over the FoxPro Screen Object. (The Screen Object is the main Visual FoxPro Window. For more information search for _Screen in the Help file.)

**************** Begin Code ******************* PUBLIC oMyScreen

oMyScreen = CREATEOBJECT('Form') oMyScreen.AddObject('Text1','TextBox') oMyScreen.Text1.Top = 5 oMyScreen.Text1.Left = 5 oMyScreen.Text1.value = 1 oMyScreen.Text1.Visible = .T. oMyScreen.AddObject('Timer1','MyTimer') oMyScreen.Show

DEFINE CLASS MyTimer AS Timer
   Interval = 1000  && Calls the Timer event every second.
   PROCEDURE Timer Event
				

x=sys(1270) DO CASE CASE TYPE('x')='O' IF x.name != 'Screen' ** Increments the value by 1 if your mouse is over ** an Object that is not the FoxPro Desktop Thisform.Text1.Value = Thisform.Text1.Value + 1 ENDIF CASE TYPE('x') = 'L' ** Increments the value by 1 if your mouse is not over ** an Object Thisform.Text1.Value = Thisform.Text1.Value + 1 ENDCASE ENDPROC

   ENDPROC
				
**************** End Code *******************

Modification Type:MajorLast Reviewed:12/23/2005
Keywords:kbcode KB141972 kbAudDeveloper