How to Use the SYS(1270) Function

Last reviewed: January 8, 1996
Article ID: Q141972
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, version 3.0b

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
**************** End Code *******************


Additional reference words: 3.00b VFoxWin
KBCategory: kbprg kbdocerr kbhowto kbcode
KBSubcategory: FxprgGeneral


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 8, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.