Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Bug with option group in VFP6?
Message
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00830472
Message ID:
00830692
Vues:
29
>>>Nadya,
>>>
>>>No, I didn't specifically try to reproduce this problem. I am 99.9% sure though that it'll be solved by setting ButtonCount = 0 in your lowest level opg subclass. If that doesn't fix it I can look into it some more.
>>
>>Hi David,
>>
>>I set ButtonCount to 0 in my class, but it didn't solve the problem :( In my code I set first option to 1 programmatically, then another option to 1 programmatically. As a result I see two options selected. But I need only the last option, which I set, to be selected. How can I solve the problem in easy way?
>>
>>Thanks a lot in advance.
>>
>>UPDATE. I've just created a test form with option group with 3 option buttons. I programmatically set button's values to 1 (2nd and 3rd) and as a result all 3 options were selected. I'm wondering, what is the behavior in VFP7/8 and is this considered a bug or not?
>>
>>In any case, what is the workaround against this behavior?
> Hi Nadya,
>How are you programmatically setting the button's values? If you do it with
>thisform.optiongroup1.value = 4 (say in the init of a form) then the 4th button in the option group will be selected.
>If you do it like this
>thisform.optiongroup1.option1.value = 0
>thisform.optiongroup1.option2.value = 1
>thisform.optiongroup1.option3.value = 1
>thisform.optiongroup1.option4.value = 0
>thisform.optiongroup1.option5.value = 1
>then options 2,3,5 will show as selected. If you add a command button with a click of
>thisform.optiongroup1.option1.value = 1
>thisform.refresh
>then options 1,2,3,and 5 will show as selected. But if you use
>thisform.optiongroup1.value = 1
>thisform.refresh
>then only option1 will be shown as selected.
>HTH Sammie

Thanks to all. So, the workaround is very simple: just set the option group value to the number of the button, I want selected. This would simplify my class, but I'm wondering, how would it affect existing configurations. I'm going to play with it more.

Thanks again.
If it's not broken, fix it until it is.


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

Click here to load this message in the networking platform