Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Scanning through objects to assign property values
Message
 
 
À
17/05/2001 15:37:40
David Fluker
NGIT - Centers For Disease Control
Decatur, Georgie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00508436
Message ID:
00508489
Vues:
25
>>Is there a way to assign property values to a group of objects if there is not a value already asssigned? I'm looking to set all the HelpContextID properties for objects on a page (form, pageframe, whatever...) to a specific value unless they have previously been assigned in development. I'm trying to think of a way to use the SetAll method to handle this... Thanks!
>>
>>Regards, Renoir
>
>Here is a sample assign method that will do what you want.
>This code makes two assumptions:
>1. If you don't set the HelpContextID it defaults to 0.
>2. Sometimes you may want SetAll("helpContextID" ##) to really set them all, and other times just the ones that are still the default value.
>
>In your base class, create an assign method to HelpContextID and a new property ProtectHelpContextID. The property defaults to .F.
>
>This code in the new assign method will do the job
>
>LPARAMETERS vNewVal
>*: Change property to new value if permitted or if default value
>IF (This.ProtectHelpContextID = .F.) OR (This.HelpContextID = 0)
>	THIS.HelpContextID = m.vNewVal
>ENDIF
>
>
>And use this code to change defaults to 999
>
form.SetAll("ProtectHelpContextID",.T.)
>form.SetAll("HelpContextID",999)
>form.SetAll("ProtectHelpContextID",.F.)
>
Hi David,

Your example first sets ProtectHelpContextID to .t., then according to the method you wrote, it would not assign 999 to HelpContextID.

Actually, this is exactly what I meant, when wrote a message to Renoir. We probably don't need the property ProtectHelpContextID, though it may be a good idea to have it.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform