Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to create a read-only property
Message
De
23/12/2004 00:41:10
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00971675
Message ID:
00971682
Vues:
20
Meaning, I will add an empty property_Assign method without actually assigning the parameter passed? That works for me. Thanks.

>You've to use Assign method to make property read-only. The COMMATTRIB is used to populate COM object type library.
>
>>Hi all, How do I create a read-only property?
>>
>>* Example: Project file: MyBizObjs (dll)
>>#DEFINE COMATTRIB_READONLY 0x100000
>>define class bizobjs as session olepublic
>>   MyReadOnlyProperty = "Hello"
>>   dimension MyReadOnlyProperty_COMMATTRIB[4]
>>   MyReadOnlyProperty_COMMATTRIB[1] = COMATTRIB_READONLY
>>enddefine
>>
>>I can still assign a value to the property: MyReadOnlyProperty by running this code:
>>
>>obo = createobject('mybizobjs.bizobjs')
>>? obo.MyReadOnlyProperty && displays Hello
>>obo.MyReadOnlyProperty = "World!"
>>? obo.MyReadOnlyProperty && displays World!
>>
>>Is there something else that I'm missing?
ramil
~~ learning to stand still
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform