How to Determine the Coordinates of a GET Field

ID: Q111549

2.50 2.50a 2.50b 3.00 | 2.00 2.50 2.50a 2.50b | 2.50b

WINDOWS               | MS-DOS                | MACINTOSH
kbprg

The information in this article applies to:

SUMMARY

To determine a GET field's coordinates, use the _CUROBJ variable to place the cursor in the desired GET field. Then use the COL() and ROW() functions to determine the row and column of the cursor.

MORE INFORMATION

Assign the _CUROBJ system variable to the desired GET field. (To determine the number of the field, use the OBJNUM() function.)

Once the cursor is in the GET field, use the ROW() and COL() functions to determine the coordinates of the cursor, which are the same as the first position of the GET field.

Program Example

The following program demonstrates the use of _CUROBJ, ROW(), and COL() to get the coordinates of a GET field. Press the F2 or F3 key to go to the desired field, then press F4 to display the coordinates of that field.

   ON KEY LABEL F2 DO GotoObj1
   ON KEY LABEL F3 DO GotoObj2
   ON KEY LABEL F4 DO DispXY
   SET TALK OFF

   @ 1, 2 get m.test1 DEFAULT SPACE(10)
   @ 3, 4 get m.test2 DEFAULT SPACE(10)
   READ CYCLE

   ON KEY LABEL F2
   ON KEY LABEL F3
   ON KEY LABEL F4

   PROCEDURE GoToObj1  && Places cursor in first field
   _CUROBJ = 1
   RETURN

   PROCEDURE GoToObj2  && Places cursor in second field
   _CUROBJ = 2
   RETURN

   PROCEDURE DispXY  && Displays coordinates of current field
   m.x = ROW()
   m.y = COL()
   WAIT WINDOW "X:" + STR(m.x,5,2) + ", Y: " + STR(m.y,5,2)
   RETURN

Additional reference words: FoxMac FoxDos FoxWin 2.00 2.50 2.50a 2.50b KBCategory: kbprg vFoxWin 3.00 KBSubcategory: FxprgGeneral
Keywords          : FxprgGeneral 
Version           : 2.50 2.50a 2.50b 3.00 | 2.00 2.5
Platform          : MACINTOSH MS-DOS WINDOWS

Last Reviewed: March 12, 1997