General information
Category:
Forms & Form designer
>>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.
Let me get this straight. When someone enters your form, on a male record, they see an unchecked box that says "male", and nothing that says "female". Such a form would look to me like it means "not male", so if I wanted the record to be male I would check the box. Then it suddenly says "female", and I would then scratch my head and un-check it. Then it will say "male" again. That's what I think would probably happen.
I maintain that a pair of option buttons are more appropriate for displaying a field storing two equivalent logical conditions. We don't want a control like a checkbox which seems to say "female" or "not female". I have never seen a paper form that looks like that. You should see a clear choice of "male" and "female".
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only