Information générale
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Optiongroup.Controlsource = a logical field
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?
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement