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

Included for backward compatibility in Visual FoxPro. Use the ControlSource Property or Name Property (Visual FoxPro) 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 in uppercase the name of the memory variable, array element, or field used to create the current @ ... GET field or control.

VARREAD()

Expand imageReturn Value

Return value - Character

Expand imageRemarks


Controls include check boxes, fields, invisible, push or radio buttons, lists, popups, spinners, and text-editing regions.

If a Browse, Change or Edit window is active, the name of the current field is returned with the first letter of the field name capitalized.

VARREAD() is identical to SYS(18). Both can be used to pass the current field or control name to a procedure that in turn can provide context-sensitive help, as in the following example.

Expand imageExample

CopyCode imageCopy Code
SET TALK OFF
CLOSE DATABASES
ON KEY LABEL F1 DO Help WITH VARREAD()
USE customer
SCATTER TO temp
DEFINE WINDOW input FROM 6,10 to 18,70 PANEL
ACTIVATE WINDOW input
@ 1,3  SAY 'Customer: ' GET company
@ 3,3  SAY 'Address: '  GET address
@ 5,3  SAY 'City: '     GET city
@ 7,3  SAY 'State: '    GET state
@ 7,18 SAY 'Zip: '      GET zip
@ 9,7  SAY 'Press  to cancel or  for help'
READ
GATHER FROM temp
DEACTIVATE WINDOW input
RELEASE WINDOW input
ON KEY LABEL F1
RETURN
*** Help Procedure ***
PROCEDURE Help
PARAMETERS fieldname
DO CASE
	CASE fieldname = 'COMPANY'
		WAIT WINDOW 'Enter the company name' NOWAIT
	CASE fieldname = 'ADDRESS'
		WAIT WINDOW 'Enter the street address' NOWAIT
	CASE fieldname = 'CITY'
		WAIT WINDOW 'Enter the city name' NOWAIT
	CASE fieldname = 'STATE'
		WAIT WINDOW 'Enter a two-character state abbreviation' NOWAIT
	CASE fieldname = 'ZIP'
		WAIT WINDOW 'Enter the five-digit Zip code' NOWAIT
ENDCASE
RETURN

Expand imageSee Also