Using Check Boxes

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:


Top of page

x
Procedure: How to Place a Check Box on Your Form
  1. Select the Check box control in the Controls palette.
  2. Draw a rectangle on your form approximately where you want your check box to be at approximately the size you want.
  3. Select the text next to the actual box, type the label you want your check box to have, and press Enter.
  4. (Optional, but recommended.) Give your check box a more meaningful name than CheckBoxn.
  5. If necessary, readjust the size and placement of your check box.
  6. Double-click the check box or select the Checked property to open the Set Check Box State dialog box.
  7. To directly set the initial state for the check box, select As selected below, and then select either 0 - No (cleared) or 1 - Yes (selected).

    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.

  8. Click OK.

Top of page

x
Syntax: How to Set the Value of a Check Box Dynamically

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:

Formname

Is the name of the form the check box is placed on.

CheckBoxName

Is the name of the check box.

0

Clears the check box.

1

Selects the check box.


Top of page

x
Procedure: How to Trigger an Action When an End User Selects a Check Box
  1. Open the Event Handler editor.
  2. Select the check box in the list of controls.
  3. Select the Check event from the list of events.
  4. Specify an event handler.

Top of page

x
Reference: Set Check Box State Dialog 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.

Set CheckBox State dialog box

This dialog box contains the following options:

Set the checked state of the control

Select As selected below to set the initial value directly.

Select From a variable to set the value from a variable.

Checked

(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.

Set CheckBox State dialog box

New variable...

(Only if you selected From a variable.) Opens the New Variable dialog box, where you can create a variable.

New data source stack...

(Only if you selected From a variable.) Opens the Stack Editor, where you can create a stack.

List of data source stacks and variables in your procedure

(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.

Data Sources - Current Area

(Only if you selected From a variable.) Lists the fields from the data sources used in this procedure).


Top of page

x
Changing Check Box Properties

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