Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Optiongroup.Controlsource = a logical field
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Optiongroup.Controlsource = a logical field
Miscellaneous
Thread ID:
00057117
Message ID:
00057117
Views:
97
Not supposed to do that, since the value is numeric. But I want the effect of that. Consider a table of people with a logical sex field, where .T. is considered female and .F. male. To FoxPro, such a field means "female, true or false." But imagine a form with a check box and a caption "Female?" Looks pretty dumb. The appropriate control is an option group with one button labeled "male" and the other "female."

I left the optiongroup.ControlSource blank, then set Option2.ControlSource = mytable.female and Option1.ControlSource = !mytable.female. That almost worked. When I navigated the table with my form, the option buttons updated correctly. But when I tried to edit a record, the buttons wouldn't switch. When I edited a female record and clicked the male option button, the female button turned off but the male button didn't turn on. Then it didn't save the change.

I know I can use code in the OptionGroup.Click and the Form.Refresh to update the controlsource, but I like controlsources. Can it be done?
Next
Reply
Map
View

Click here to load this message in the networking platform