Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CheckBox forgets state
Message
 
To
20/01/2004 17:15:41
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00868781
Message ID:
00868820
Views:
12
>>My app uses a checkbox to manage mousemove services. My convention is to use 0 for off and 1 for on.
>>
>>Somtimes, CheckBox forgets its a number, and VFP messages Operand/Data Type error. And sure enoug, when I look at the state recorded at last "bomb", the checkbox type has changed from numberical to logical.
>>
>>Maybe I should swith to a true/false application of check box?
>>
>>Oh yeah, it's VFP-8 and the crash happens inside a treeview mouse move when the question is asked:
>>
if MyCheckBox.Value=0
>>   ....
>>endif
>>
>>Thanks
>
>I had the problem the other way around (in VFP6): If I didn't specify a value, it was sure to be numeric, where I expected it to be logical (logical is more "logical" for T/F questions, isn't it?)
>
>Make sure you assign the correct value in the property sheet, Init() method, etc.
>
>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
Imagination is more important than knowledge
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform