Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Optiongroup.Controlsource = a logical field
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00057117
Message ID:
00057488
Vues:
80
>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 think we've had a similar thread some time ago. I'd use a checkbox with variable caption. So, if it's checked, it reads "female", if it's .f. it reads "male". My checkbox class has two additional properties, caption_yes and caption_no, so the caption is set properly whenever showing the value or when clicking.
 *click, the same code goes into .init
if this.value and !empt(this.caption_yes)
    this.caption=this.caption_yes
    retu
endif
if !this.value and !empt(this.caption_no)
    this.caption=this.caption_no
    retu
endif


Property sheet
BackStyle = 0
Caption = "Check1"
Value = .F.
caption_yes = ("")
caption_no = ("")

(omitted the properties which may default to anything you want).
In your case, you just use this class (or change only the checkbox on
your form) and put
caption_yes = ("female")
caption_no = ("male")

Maybe the .click method should be a separate method, and called from
..click, .refresh .interactivechange, .programmaticchange and .init -
just to make sure it never shows the wrong caption.


back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform