Links are not active on this page.
 OBJNUM( ) Function

Included for backward compatibility. Use the TabIndex Property for controls instead.

This function is undocumented in the original VFP9 help file,
but the following documentation was found in the FoxPro for Windows 2.6 help, and may still be valid:

Returns the object number of an @ ... GET control.

OBJNUM(var [, expN])

Parameters

var
 var is the name of the memory variable, array element or field specified when you create the control.

expN
 Nested READs are created by issuing @ ... GETS and a READ in a routine called during a READ. READs can be nested to five levels. To return a control number for a control at a read level other than the current read level, include the optional read level number expN. If expN is omitted, OBJNUM() returns the @ ...GET control number for the current read level.

Expand imageReturn Value

Return value - Numeric

Expand imageRemarks


You can use @ ... GET and @ ...EDIT to create controls, sometimes called objects. These controls are fields, check boxes, lists, popups; invisible, push, and radio buttons; spinners and text-editing regions. OBJNUM() returns a number that corresponds to a control's creation order in a set of controls.

Expand imageExample

The following example creates a window and places radio buttons in the window so you can move the record pointer through an open table. If a table isn't open, the Open dialog is displayed so you can select a table to open.

CopyCode imageCopy Code
SET TALK OFF
DEFINE WINDOW gotodialog FROM 9, 17 TO 19,61 ;
	FLOAT NOCLOSE SHADOW DOUBLE COLOR SCHEME 5
PRIVATE file,lastobj,enter,tab,shifttab,up,down,left,right
*** Assign lastkey values ***
enter		= 13
tab			= 9
shifttab	= 15
up			= 5
down		= 24
right		= 4
left		= 19
lastobj	= 1
*** Open a table ***
IF EMPTY(DBF())
	file = GETFILE('DBF','Pick a table')
	IF EMPTY(FILE)
		WAIT WINDOW 'Cancelled' NOWAIT
		RETURN
	ENDIF
	USE (file)
ENDIF
*** Draw the fields ***
ACTIVATE WINDOW gotodialog
@ 0,1 TO 8,25
@ 1,3 GET radio PICTURE '@*RVN \ RECCOUNT()
				WAIT WINDOW 'Record out of range' NOWAIT
			ELSE
				GO recordnum
			ENDIF
		CASE radio = 4
			IF skipnum+RECNO() > RECCOUNT() OR skipnum + RECNO() < 0
				WAIT WINDOW 'Record out of range' NOWAIT
			ELSE
				SKIP skipnum
			ENDIF
	ENDCASE
ENDIF

Expand imageSee Also