📄 makeobject.prg
字号:
*==============================================================================
* Program: MakeObject
* Purpose: Create an object from a specified class and library
* Author: Doug Hennig
* Copyright: (c) 1997 Stonefield Systems Group Inc.
* Last revision: 03/09/99
* Parameters: tcClass - the name of the class to instantiate
* tcLibrary - the name of the class library containing
* the class
* tcInApp - the name of the application the class is in
* tuParm1 - an optional parameter to pass to the new
* object's Init method
* tuParm2 - an optional parameter to pass to the new
* object's Init method
* tuParm3 - an optional parameter to pass to the new
* object's Init method
* tuParm4 - an optional parameter to pass to the new
* object's Init method
* tuParm5 - an optional parameter to pass to the new
* object's Init method
* tuParm6 - an optional parameter to pass to the new
* object's Init method
* Returns: the return value from NEWOBJECT() (usually an object
* reference but it could also be .NULL. if the object
* failed to instantiate)
* Environment in: if tcLibrary isn't specified, it must already be opened
* with SET CLASSLIB (for a VCX) or SET LIBRARY or SET
* PROCEDURE (for a PRG)
* Environment out: the object may have been instantiated
* Note: This routine should be used rather than NEWOBJECT()
* because that function needs to find the VCX file even
* if it's already in SET CLASSLIB
*==============================================================================
LPARAMETERS tcClass, ;
tcLibrary, ;
tcApplication, ;
tuParm1, ;
tuParm2, ;
tuParm3, ;
tuParm4, ;
tuParm5, ;
tuParm6
LOCAL lcLibrary, ;
llLibrary, ;
lnParms, ;
loObject
lcLibrary = IIF(EMPTY(tcLibrary) OR UPPER(tcLibrary) $ SET('CLASSLIB') OR ;
UPPER(tcLibrary) $ SET('PROCEDURE'), '', tcLibrary)
llLibrary = EMPTY(lcLibrary) OR FILE(tcLibrary) OR ;
FILE(tcLibrary + '.VCX') OR FILE(tcLibrary + '.PRG')
lnParms = pcount()
DO CASE
CASE lnParms = 1
loObject = CREATEOBJECT(tcClass)
CASE NOT llLibrary
loObject = .NULL.
CASE lnParms = 2
loObject = newobject(tcClass, lcLibrary)
CASE lnParms = 3
loObject = newobject(tcClass, lcLibrary, tcApplication)
CASE lnParms = 4
loObject = newobject(tcClass, lcLibrary, tcApplication, @tuParm1)
CASE lnParms = 5
loObject = newobject(tcClass, lcLibrary, tcApplication, @tuParm1, ;
@tuParm2)
CASE lnParms = 6
loObject = newobject(tcClass, lcLibrary, tcApplication, @tuParm1, ;
@tuParm2, @tuParm3)
CASE lnParms = 7
loObject = newobject(tcClass, lcLibrary, tcApplication, @tuParm1, ;
@tuParm2, @tuParm3, @tuParm4)
CASE lnParms = 8
loObject = newobject(tcClass, lcLibrary, tcApplication, @tuParm1, ;
@tuParm2, @tuParm3, @tuParm4, @tuParm5)
CASE lnParms = 9
loObject = newobject(tcClass, lcLibrary, tcApplication, @tuParm1, ;
@tuParm2, @tuParm3, @tuParm4, @tuParm5, @tuParm6)
ENDCASE
RETURN loObject
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -