Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Control of three options
Message
From
07/07/2011 10:19:18
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01517424
Message ID:
01517578
Views:
56
>First, thank you for your suggestions. I get it that I need to create a container control with three option buttons. This is fine.
>
>But I don't understand why there are 8 possibilities. How do you get the value of 7?

With three checkboxes, each of which can have one of two values, there are 2^3 different combinations (2 x 2 x 2). To assign a single numeric value to this, powers of two are often used - thus, one option has the value 1, the other 2, the other 4.

>
>>(1) I think there are 8 possibilities - from 0 to 7
>>shift1 = 2 ^0
>>shift2 = 2^1
>>shift3 = 2^ 2
>>
>>
>>(2) I'm afraid you'll have to use a container with 3 option buttons
>>
>>(3) Add an unvisible spinner to the container (range 0-7) and set the controlSource of the spinner to the field
>>
>>(4) add code to the container
>> - refresh = setting the options on/off (easy with bittest(field, 0) , bittest(field, 1) , bittest(field, 2)
>>
>>(5) add code to the optionbuttons (interactive change) to set the value of the spinner accordingly
>>
>>_
>>
>>>Hi,
>>>
>>>I need to create a control that will have 3 choices kind of similar to how the option group control works but use should be able to select more than 1 choice. For example:
>>>
>>>Shift 1 [ ] Shift 2 [ ] Shift 3 [ ]
>>>
>>>The control should be bound to one field, of Int type. So that the value stored in the field would be as following:
>>>0 - if user didn't make any selection
>>>1 - If user selected Shift 1
>>>2 - Shift2
>>>3 - Shift1 + Shift2
>>>4 - Shift1 + Shift3
>>>5 - Shift2 + Shift3
>>>6 - Shift1 + Shift2 + Shift3
>>>
>>>The only way I can think of is by creating a container-based class with three optio control buttons.
>>>
>>>But, in case I am missing something, is there a way to use one native VFP control for this?
>>>
>>>TIA.
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)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform