Article ID: 143205
Article Last Modified on 9/30/2003
GETPEM(oObjectName | cClassName, cProperty | cEvent | cMethod)GETPEM receives either an object name or a class name as a first parameter. This means that the GETPEM() function does not require an instance of the class to return a value. In the following example, GETPEM is called to return the value of a property. The first time GETPEM is used, the first parameter is an object name. The second GETPEM verifies the value of the Caption property at the class level.
oObjRef=CreateObject('myform')
oObjRef.Show
oObjRef.Caption="Testing the New Function"
?'Caption of the Object: '
??GETPEM(oObjref,'Caption')
?'Caption in the Class: '
??GETPEM('myform','Caption')
=Messagebox('Press Any Key to Clear')
DEFINE CLASS myform as Form
Caption="Testing GETPEM"
ENDDEFINE
Note that the first parameter does not require quotation marks when it is a
variable that references an object. However, if the first parameter is the
name of a class, and you do not type quotation marks, the error "Variable
<var> is not Found" is returned.
?GETPEM('TextBox','FontName')
You can use this to determine default attributes of objects before you
modify them. To return a value on a user defined class, GETPEM requires
that the class be cached in memory. It does not, however, require that an
instance of the class actually exist. To have a class cached in memory, you
need to create an instance of the user defined class. You can then release
this instance. For example:
oTool1=CREATEOBJECT('ToolBar')
oTool1=.NULL.
A CLEAR ALL or CLEAR CLASS ClassName would release the class from memory.
Note that GETPEM does not search a Visual Class Library (VCX) opened with
the SET CLASSLIB command. You also need to create an instance of the class
and release it when you search a class defined in a VCX.
ON KEY LABEL F7 WAIT WINDOW GETPEM(SYS(1270),'Class')
RELAESE THISFORM && error that calls the event handler
LPARAMETERS nError, cMethod, nLine ACTIVATE SCREEN ?'ERROR'+ALLTRIM(STR(nError))+'IN LINE'+ALLTRIM(STR(nLine))+':' ?GETPEM(THIS,cMethod)
Additional query words: debug trace builder wizard
Keywords: KB143205