*  Program...........: AddProp (Add Property)
*  Author............: Paul Bienick (AddProp.fll)
*                      Ken Levy (AddProp.txt)
*  Project...........: AddProp
*  Created...........: 09/05/1995
*  Copyright.........: (Public Domain) Flash Creative Management, Inc., 1995

* AddProp.fll contains one function AddProp() which is used to add
* properties to existing objects, outside of the class definition.

* Syntax:
*   AddProp(cName, cProperty, uValue)
* Arguments:
*   cName
*     Specifies the name used to reference the object.
*   cProperty
*     Specifies the name of the new property to be created.
*   uValue
*     Specifies the value of the new property.


* Sample program to demo AddProp.fll

LOCAL oTest,oForm,lnCount

SET LIBRARY TO AddProp ADDITIVE		&& Include AddProp in library path
oTest=CREATEOBJECT('Custom')		&& Create custom instance
=AddTimeStamp(oTest)				&& Add TimeStamp property to oTest
=AddProp(oTest,'nCounter',0)		&& Add nCounter proeprty to oTest
oForm=CREATEOBJECT('Form')			&& Create form instance
=AddTimeStamp(oForm)				&& Add TimeStamp property to oForm
FOR lnCount = 1 TO 5000				&& Increment oTest counter in loop
	oTest.nCounter=oTest.nCounter+1
ENDFOR
oForm.tTimeStamp=DATETIME()			&& Reset oForm TimeStamp
=DisplayTimeStamp(oTest)			&& Display oTest TimeStamp
=DisplayTimeStamp(oForm)			&& Display oForm TimeStamp
? oTest.nCounter					&& Display oTest counter
=AddProp(_screen,'nCount',0)		&& Add nCount property to _screen
									&& Note that _screen.nCount exists even
									&&   after a CLEAR ALL is executed
_screen.nCount=1					&& Set new nCount property to 1
									&& _screen.nCount is a global which will
									&&   even after a CLEAR ALL is executed
? _screen.nCount					&& Display _screen.nCount
RETURN



FUNCTION AddTimeStamp(toObject)

IF TYPE('toObject.tTimeStamp')=='T'
	RETURN
ENDIF
RETURN AddProp(toObject,'tTimeStamp',DATETIME())
ENDFUNC



FUNCTION DisplayTimeStamp(toObject)

IF TYPE('toObject.tTimeStamp')#'T'
	RETURN .F.
ENDIF
ACTIVATE SCREEN
? toObject.tTimeStamp
RETURN
ENDFUNC
