In this section: How to:
Reference: |
Use check boxes in your forms to enable your end users to turn options on and off.
There are several ways you can use a check box in your form:
For example, if you were creating a program that registered guests at your hotel, you might ask if they want a non-smoking room. Answering yes or no is as simple as selecting or clearing the check box.
To assign the state of the check box to a variable, select From a variable. Then select a variable or data source stack column.
Note: You can create a new variable or data source stack by clicking New variable or New data source stack. For more information, see How to Create a Variable in a Procedure or How to Create a Data Source Stack Explicitly Using the Stack Editor.
The variable or stack column should have a value of 1 or 0, if numeric.
If you want to reset the value of a check box to its initial value, issue the following command
COMPUTE Formname.CheckBoxName.Checked = {0|1};
where:
Is the name of the form the check box is placed on.
Is the name of the check box.
Clears the check box.
Selects the check box.
Use the Set Check Box State dialog box to determine whether the check box will be selected or cleared initially, or whether its value will be assigned to a variable or data source stack column.
This dialog box contains the following options:
Select As selected below to set the initial value directly.
Select From a variable to set the value from a variable.
This is available only if you selected As selected below.
Select 0 - No to clear the check box initially (the default).
Select 1 - Yes to select the check box initially.
This is available only if you select From a variable. This option opens the New Variable dialog box, where you can create a variable.
This is available only if you select From a variable. This option opens the Stack Editor, where you can create a stack.
This is available only if you select From a variable. This option contains a list of the existing stacks and variables in your procedure.
Either select a variable, or expand a data source stack and select a column.
This is available only if you select From a variable. This option lists the fields from the data sources used in this procedure.
When you select your check box, you will see a list of check box properties in the property sheet. Changing these properties will change what your check box looks like and what it does at run time.
Many of the styling properties can also be changed using a Cascading Style Sheet. For more information on Cascading Style Sheets, see Using Cascading Style Sheets.
Choose your check box property based on the task you wish to perform:
If you want to change the label that identifies the check box to the end user, use the Text Property. For more information, see the Text Property.
If you want to change the name of the check box that identifies it to the procedure, use the (Name) Property. For more information, see the (Name) Property.
If you want to change the initial setting for the check box or assign the check box state to a variable, use the Check Box State dialog box. For more information, see Set Check Box State Dialog Box.
If you want to change the size or location of the check box, use the Bottom Property, Left Property, Right Property, Top Property, or use a style sheet. For more information, see the Bottom Property, Left Property, Right Property, and Top Property. You can also move or resize the check box directly in the form.
If you want to change the color of the check box, use the BackColor Property to determine the background color, the ForeColor Property to determine the color of the text in the label, or use a style sheet. For more information, see the BackColorOver Property and the ForeColor Property.
If you want to change the label font, use a style sheet or use the Font Property. For more information, see the Font Property.
If you want to move the label to the other side of the check box, use the TextOnLeft Property. For more information, see the TextOnLeft Property.
If you want to make the check box inactive or make it invisible, use the Enabled Property to determine whether the check box is active or not. If the check box is inactive, it will be dimmed out and nothing will happen when the end user clicks it. You can also use the Visible Property to determine whether the check box is visible to the end user or use a style sheet. For more information, see the Enabled Property and the Visible Property.
If you want to change what the cursor looks like when it is on top of the check box, use the CursorPointer Property or use a style sheet. For more information, see the CursorPointer Property.
If you want to display a tooltip when the cursor is on the top of the check box, use the ToolTipText Property. For more information, see the ToolTipText Property.
If you want to assign a Help topic to the check box, use the Help Property. For more information, see Assigning Help to Your Forms and Controls.
If you want the end user to be able to tab to the check box, use the Tabstop Property. For more information, see the Tabstop Property.
If you want to move the check box to another layer, use the Layer Property. For more information, see Layering Controls.
If you want to control the display order of the check box when more than one control is overlaid, use the ZIndex Property. For more information, see the ZIndex Property.
WebFOCUS |