In this section: How to:
Reference: |
You 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. (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.
You 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.
(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.
(Only if you selected From a variable.) Opens the New Variable dialog box, where you can create a variable.
(Only if you selected From a variable.) Opens the Stack Editor, where you can create a stack.
(Only if you selected From a variable.) 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.
(Only if you selected From a variable.) 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.
Do you want... |
Then use... |
---|---|
to change the label that identifies the check box to the end user? |
the Text Property property. |
to change the name of the check box that identifies it to the procedure? |
the (Name) Property property. |
to change the initial setting for the check box or assign the check box state to a variable? |
the Checked property to open the Set Check Box State Dialog Box dialog box. |
to change the size or location of the check box? |
the Bottom Property, Left Property, Right Property, and Top Property properties. a style sheet. (You can also move or resize the check box directly in the form.) |
to change the color of the check box? |
the BackColor Property property to determine what the background color is. the ForeColor Property property to determine the color of the text in the label. a style sheet. |
to change the label font? |
the Font Property property. a style sheet. |
to move the label to the other side of the check box? |
the TextOnLeft Property property. |
to make the check box inactive or make it invisible? |
the Enabled Property property to determine whether the check box is active or not. (If the check box is inactive, it will be grayed out and nothing will happen when the end user clicks it.) the Visible Property property to determine whether the check box is visible to the end user. a style sheet. |
to change what the cursor looks like when it is on top of the check box? |
the CursorPointer Property property. a style sheet. |
to display a tool tip when the cursor is on top of the check box? |
the ToolTipText Property property. |
to assign a help topic to the check box? |
the Help property. For more information, see Assigning Help to Your Forms and Controls. |
the end user to be able to tab to the check box? |
the Tabstop Property property. |
to move the check box to another layer? |
the Layer property. For more information, see Layering Controls. |
to control the display order of the check box when more than one control is overlaid? |
the ZIndex Property. Note: IE7 or equivalent required. |
WebFOCUS |