Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Big trouble with AddProp5.fll
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00661729
Message ID:
00662624
Vues:
23
It seems to me that it cannot handle tables with field names that are the same as VFP class properties or methods, Name, for example.

>>Thanks for your time, Christof.
>>
>>Foar a while, the workaround I´ve found filled my needs. In a near future, hopefully we´ll have more support for AddProp in "SCATTERED" objects. ;)
>
>One way to handle adding properties to SCATTERed objects may be to approach this from the other side. You can replace the native SCATTER command with your own function MYSCATTER which may work on any area
>
>
>* myScatter.PRG
>myScatterObject = CREATEOBJECT("myScatterObject")
>IF !EMPTY(ALIAS())
>	lnFields = FCOUNT(ALIAS())
>	FOR N =1 TO lnFields
>		myScatterObject.ADDPROPERTY(FIELD(N), EVAL(FIELD(N)))
>	ENDFOR
>ENDIF
>RETURN myScatterObject && Always return an object, so GATHER command could not choke.
>
>DEFINE CLASS myScatterObject AS SESSION
>* Optionally you may define the native PEMs here as HIDDEN
>ENDDEFINE
>
>
>Then you go to the record you need and:
>
>SELECT mytable
>scattered1 = MYSCATTER() && This is instead of SCATTER NAME...
>
>* .... && more code here
>
>* Now add a property using the native AddProperty method and assign any value to it.
>scattered1.addProperty("newPropertyName", "This is the new property value")
>
>SELECT othertable
>GATHER NAME scattered1 MEMO
>
>
>Note that you still can use the native GATHER command here.
>The scope of scattered1 variable and other code safety features are up to you.
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform