The Check Box (

) form object represents a check box, which can be selected or cleared. A selected check box sets the data source value to
on, and a cleared check box sets the value to
off.
In addition, the Settings window contains the following sections:
In this section you specify the data source for the check box. The section contains a tree with a filtered view of the tree in the Application Builder window. The nodes either represent some sort of data or have children that do. For a check box, variables in the COMSOL model and scalar strings and Boolean variables that you define under
Declarations are available as the data source. You can extend the list of available data nodes by clicking the
Switch to Model Builder and Activate Model Data Access button (

) in the
Source section header, which takes you to the Model Builder, and then selecting a node in the
Model Builder branch whose data you want to access. With this button active, the
Settings window of the selected node displays a
Select Data Source check box (a green square) next to the settings that you can include. Click to select the check box to include that data as an available source node for check boxes.
When you select a node that represents data, the Use as Source toolbar button (

) below the tree becomes enabled. You can right-click the node and choose
Use as Source. You can also click the
Create button (

) in the
Source section header to create a new variable declaration and use it as the source. A
Create and Use Variable dialog box opens, so that you can select the data type of the source (if applicable), its name, and its initial value. The name cannot be in conflict with any existing variable declaration. Click the
Edit Node toolbar button (

) below the tree to move to the corresponding node. If necessary, the program switches to the Model Builder.
From the Initial value list, select
From data source to link this check box to a variable defined in the
Source section above and use the value specified by that data source. Select
Custom value to specify the initial state from the
Initial state list:
Selected (the default) or
Cleared. The value for a selected check box is
on, and for a cleared check box it is
off.
The need to specify the alignment is most obvious when working in the grid mode; then it controls how the form object is aligned in its grid cell. Aligning the form object can be useful in the sketch mode too, and you can then use the alignment tools on the Arrange menu in the
Form toolbar’s
Sketch section. When running the application in any client other than the Windows client, the form objects may not be positioned exactly as seen in the Application Builder. This is because the form objects may have a different size in other clients, giving them a slightly different positioning. Specifying the alignment ensures that the form objects are aligned as you want them to be in all clients.
The Width and
Height fields are unavailable because the dimensions of the check box are determined by the software.
Additionally, in the sketch mode, you can specify the form object’s absolute position using the Position x and
Position y fields. In the grid mode, you can position the object in the grid and see the grid position as the
Row,
Column,
Row span, and
Column span values.
Under Cell margin (in grid mode only), you can control the margins around the form object. By default, the margins are taken from the parent form. From the
Cell margin list, choose:
Under State, you can control the initial state of the check box when users run the application. By default, the check box is visible and enabled. Clear the
Visible or
Enabled check box if you want to make the initial state so that the check box is hidden or unavailable. You can then make it visible or enable it using a method.
You can add a code method that the application runs when the user changes the value of the check box. The event is triggered after the new data value is stored in the data source. The On data change list contains
None (the default) and any available methods. To add a local method for this event, click the
Create Local Method button (

) or right-click the check box object. The selected method in the
On data change list then changes to
Local method. To open the local method, click the
Go to Source button (

). An empty
onDataChange editor window then opens, where you can define the local method. Click the
Remove Local Method button (

) to delete the local method.