Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A little competition :-)
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00729533
Message ID:
00729545
Vues:
18
The name of the property should be something meaningful to you and whoever has to maintain your code should you pass it on to someone else. I would call it lUseFormEditStatus. You are missing the ENDCASE. I would have code more like:
PROC Refresh
WITH This
   DO CASE
      CASE ISNULL(.xyz) or VARTYPE(.xyz) <> "L"
         * nothing to do
      CASE .xyz
         * set enabled state to the same value of forms editmode
         .Enabled = ThisForm.lEditMode
      OTHERWISE
         * set enabled state to the opposite value of forms editmode
         .Enabled = (NOT ThisForm.lEditMode)
   ENDCASE
ENDWITH
ENDPROC
Ideally, since you say this is a custom button class, I would create an Assing method for this property in the button class. WHenever the property is assigned a value, return FALSE if the new value being assigned to it is not logical. Then you have no need to check to see if it is null or not logical.

>Hi, folks!
>
>Here is a little "competition" <vbg>:
>
>I have a class called "MyButton" with a property "xyz"!
>
>In the refresh event I put the following code:
>
>PROC Refresh
>WITH This
>	DO CASE
>	CASE ISNULL(.xyz)
>		* nothing to do
>	CASE .xyz = .T.
>		* set enabled state to the same value of forms editmode
>		.Enabled = ThisForm.lEditMode
>	CASE .xyz = .F.
>		* set enabled state to the opposite value of forms editmode
>		.Enabled = (NOT ThisForm.lEditMode)
>ENDWITH
>ENDPROC
>
>
>Now the question: What is a good, proper, correct name of the property "xyz"?
Mark McCasland
Midlothian, TX USA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform