The information in this article applies to:
- Microsoft FoxPro for Windows, versions 2.5, 2.5a, and 2.5b
- Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, 2.5a, and 2.5b
- Microsoft FoxPro for Macintosh, version 2.5b
SUMMARY
It is often desirable to enable one check box while disabling the others on
a screen. By enabling only one check box and disabling the others, the
color of the disabled ones will change and become dimmed. This will
emphasize that only one of these check boxes can be selected at any given
time.
See the procedure below for a demonstration of how to accomplish this.
MORE INFORMATION
Below are the steps to create the check boxes:
- Open the Screen Builder and select the Check Box tool. (In FoxPro for
MS-DOS, choose Check Box from the Screen menu.)
- Create three check boxes on the screen with the first one having the
variable check1, the second one having the variable check2, and the
third one having the variable check3.
- In the VALID clause of the first check box, type in this code:
IF check1=1
SHOW GET check2 DISABLED
SHOW GET check3 DISABLED
ELSE
SHOW GET check2 ENABLED
SHOW GET check3 ENABLED
ENDIF
- In the VALID clause of the second check box, type in this code:
IF check2=1
SHOW GET check1 DISABLED
SHOW GET check3 DISABLED
ELSE
SHOW GET check1 ENABLED
SHOW GET check3 ENABLED
ENDIF
- In the VALID clause of the third check box, type in this code:
IF check3=1
SHOW GET check1 DISABLED
SHOW GET check2 DISABLED
ELSE
SHOW GET check1 ENABLED
SHOW GET check2 ENABLED
ENDIF
After generating the screen and running it, click one of the check boxes.
When one box is selected, the others will be disabled. To enable all the
check boxes, click the box that is selected (the one that has an "X" in
it). This will clear the box and make all the check boxes enabled until
another check box is selected.
The variables check1, check2, and check3 will always have a value of 0 or
1. Therefore, when the variable is evaluated, this is how the IF statement
is used enable or disable the check boxes.
|