_INDENT

ObjNum(), ObjVar(), _CurObj

Here's another batch of stuff that was crucial in FoxPro 2.x and is obsolete in Visual FoxPro. In FoxPro 2.x, each item (@ ... GET or @ ... EDIT) on a screen was assigned a unique "object number." Within button groups, each button received its own number. These two functions and one system memory variable operated on those object numbers.

OBJNUM() takes a variable listed in @ ... GET or @ ... EDIT and returns its object number. OBJVAR() (added in version 2.6) takes an object number and returns the name of the variable associated with it. _CUROBJ controls the focus—it contains the number of the object with focus. Changing _CUROBJ changes the focus.

Visual FoxPro has alternative ways to accomplish these tasks, and the object-number system is only partly there. Visual FoxPro forms don't use it. Forms that include any @ ... GETs or @ ... EDITs do, but OBJNUM() and OBJVAR() don't recognize any Visual FoxPro controls on the form, only the GETs and EDITs.

The bottom line is: don't mix and match. Use Visual FoxPro's new form methodology. Refer to objects on the screen by their object hierarchy (Form.Page frame.Page.Object) rather than a number, and move focus to the desired object by calling its SetFocus method. If you can't do this for some reason, then stick completely with the old @-based system.

See Also

@ Commands, ActiveControl, SetFocus, This


View Updates

Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.



Hacker's Guide to Visual FoxPro 7. 0
Hackers Guide to Visual FoxPro 7.0
ISBN: 1930919220
EAN: 2147483647
Year: 2001
Pages: 899

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net