Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CheckBox forgets state
Message
De
20/01/2004 21:34:18
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00868781
Message ID:
00868823
Vues:
12
>>Another option is to change the code in your example as follows:
>>
>>
if empty(MyCheckBox.Value) && works both for 0 and .F.
>>   ....
>>endif
>>
>>HTH,
>
>Thanks Hilmar - that would be better than:-)
>
if ((vartype(checkbox.value)="L" and checkbox.value=.t.) or ;
>   (vartype(checkbox.value)="N" and checkbox.value=1)) and ;
>   !vartype(checkbox.value)="U"
>   checkbox=.t.
>endif
>
>It could go on forever

Yes, the code with empty() is definitely simpler, and I used this kind of code in several places. Of course, the idea solution would be to make sure the checkbox has the desired type - but I don't know how to solve the problem you reported, of VFP8 changing the type unexpectedly.

If you do manage to solve this, it seems better to me to keep the code as
if MyCheckBox.Value
...
or
if MyCheckBox.Value = 1
...
depending on whether you desire a logical or a numerical field. In this case, any unexpected change in the type would be quickly caught.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform