LParameters, Parameters, Set UDFParms, Set("UDFParms")
PARAMETERS and LPARAMETERS specify the formal parameters for a procedure or function. SET UDFPARMS determines whether the default for parameters sent to functions is passing by value or by reference. (For basics on parameter passing, see "Pass the Parameters, Please" in "Xbase Xplained.")
Usage |
LPARAMETERS Parameter1 [ AS Type1 [ OF ClassLib1 ] ] [, Parameter 2 [ AS Type2 [ OF ClassLib2 ] ] [, � ] PARAMETERS Parameter1 [ AS Type1 [ OF ClassLib1 ] ] [, Parameter 2 [ AS Type2 [ OF ClassLib2 ] ] [, � ] |
VFP 7 mishandles multi-line parameter statements for methods. When you create a subclass and one of the methods of the original class has a multi-line parameter list, the parameter list for that method of the subclass all appears on a single line. In VFP 6, any tabs or spaces that were placed at the beginning of the second and subsequent lines are removed; in VFP 7, those tabs and spaces are copied into the single line. |
In addition, under some circumstances in the original release of VFP 7, if the parameter statement isn't the first in the method, it doesn't get copied to the same method in a subclass. This bug is fixed in Service Pack 1. |
You can also list parameters as part of the function or procedure heading. Parameters created that way are local. See the comments in the example below for an example of how to do this. |
Example |
FUNCTION OneName * Take a first name and last name and return one name. * If either parameter is missing or is the wrong type, * return the empty string. * The heading could be: * FUNCTION OneName(cFirst, cLast) * instead, and the LPARAMETERS line omitted, * with the same effect. LPARAMETERS cFirst, cLast * Test parameters. IF PCOUNT() < 2 RETURN "" ENDIF IF TYPE("cFirst") <> "C" RETURN "" ENDIF IF TYPE("cLast") <> "C" RETURN "" ENDIF RETURN TRIM(cFirst) + " " + TRIM(cLast) |
Usage |
SET UDFPARMS TO REFERENCE | VALUE cParmSetting = SET( "UDFPARMS" ) |
See Also |
Function, Local, Parameters(), PCount(), Private, Procedure, Set |