Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Initializing/add an object in a method/proc of a class
Message
De
20/09/2007 14:24:30
 
 
À
20/09/2007 14:18:31
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01255782
Message ID:
01255801
Vues:
14
>>>I wrote a procedure that will initialize/add an object, but it will only work at the THIS level. Fine for what I needed it for, but how can I use it at other levels of a class? Say, one level down from "THIS", so that it would be "THIS.oObject" that I wanted to run it for?
>>>
>>>
>>>	*******************************************************************************
>>>	PROCEDURE InitializeObject(ObjectName)
>>>
>>>		IF PEMSTATUS(THIS,ObjectName,5)
>>>			THIS.ObjectName = NULL
>>>		ELSE
>>>			ADDPROPERTY(THIS,ObjectName)
>>>		ENDIF
>>>
>>>	ENDPROC
>>>
>>
>>If this is a class definition that will work no mater at what level is your class. That property will be available in all subclasses also. If you want to use that property outside of that class you must use it that way:
>>
>>*** Lets say that class instance is named MyClass1 in the form:
>>
>>thisform.MyClass1.ObjectName.DoSomething && If ObjectName is object
>>
>
>Ok, in the following block of code I have the first set that uses the proc and works great, but the second one doesn't work because of "THIS.oSendData" as opposed to just using "THIS" like the proc does. Sorry, but I just can't get my head around it. Do I need to send "THIS.oSendData" or "THIS" to the proc to make it work?
>
>
>		THIS.InitializeObject("oEncodingCharacters")
>		THIS.InitializeObject("oComponentSeparator")
>		THIS.InitializeObject("oRepetitionSeparator")
>		THIS.InitializeObject("oEscapeCharacter")
>		THIS.InitializeObject("oSubcomponentSeparator")
>
>		ADDPROPERTY(THIS.oSendData, 'Company', Company)
>		ADDPROPERTY(THIS.oSendData, 'DataExchangeType', DataExchangeType)
>		ADDPROPERTY(THIS.oSendData, 'DataArea', DataArea)
>		ADDPROPERTY(THIS.oSendData, 'strProcessData', strProcessData)
>
ADDPROPERTY(THIS.oSendData, 'Company', Company)
ADDPROPERTY(THIS.oSendData, 'DataExchangeType', DataExchangeType)
ADDPROPERTY(THIS.oSendData, 'DataArea', DataArea)
ADDPROPERTY(THIS.oSendData, 'strProcessData', strProcessData)
What is oSendData?
Where it is Initialized?
Also what is Company (3th parameter of AddProperty)?
Can you post the whole code of that class?
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform