CheckBox
This control is the computer equivalent of all those little "Check All that Apply" spaces on paper forms. It's useful for items that have two states—"it is" or "it ain't."Use check boxes for items that fit the "this is"/"this isn't" division. If you can't think of a word or short phrase that can be preceded by "is" or "is not" to indicate the state of the check box, then it's probably not the right control. For example, a check box is great for distinguishing between Active and Inactive ("is active"/"is not active" makes sense), but lousy for specifying gender ("is male"/"is not male" sounds weird). For those cases where a check box won't do, consider an option group instead. Having said that, we now have to tell you that check boxes in Visual FoxPro have three possible values. In the immortal words of George Carlin, "Why are there three?"Actually, it's for a pretty good reason. There are cases where the answer to the "is/is not" question is "I dunno." With Visual FoxPro, you can actually handle that case. (However, the only way for the user to actually enter an "I don't know" value is by pressing CTRL+0. Not only is this totally non-intuitive, but pressing CTRL+0 on a field that doesn't accept nulls generates an error.)"I don't know" is the layman's term for null, which is one of the nicer additions in Visual FoxPro. The Value of a check box can be .F., .T. or .NULL. (or, if you have a C background, 0, 1, or 2).
Property |
Value |
Purpose |
Numeric |
Determines which side of the caption the actual box is on. |
|
Logical |
Determines whether the check box resizes itself to the size of its caption and picture. |
|
Character |
The text that appears next to the check box. |
|
Character |
The file names of pictures that appear on a graphical check box. Picture is used when the box is unchecked. DownPicture is used when the box is checked. DisabledPicture is used when the check box is disabled. If DownPicture or DisabledPicture is omitted, Picture is used for those states as well. |
|
Numeric |
Determines the physical appearance of the check box: 3-D (0); Plain (1), meaning flat; Hot Tracking (2), meaning flat until the mouse is over it or it gets focus. The Hot Tracking value works only for graphical check boxes (Style=2). For standard check boxes, choosing Hot Tracking is the same as choosing Plain. |
|
Numeric |
Determines whether the check box is textual or graphical. A graphical check box shows both the picture and the caption. |
Example |
* Set up a CheckBox subclass that's * right-aligned and autosized and * displays a message when clicked. DEFINE CLASS RightCheck AS CheckBox Alignment = 1 AutoSize = .T. PROCEDURE Click WAIT WINDOW "You called?" NOWAIT ENDPROC ENDDEFINE |
See Also |
Alignment, AutoSize, Caption, DisabledPicture, DownPicture, MouseEnter, MouseLeave, OptionGroup, Picture, SpecialEffect, Style |