The Knob (

) form object works like a circular slider. You can use the knob as a form object for altering the value of some source data as an alternative to a slider. Specify a name for the knob object in the
Name field. The values when turning the knob varies from the value in the
Minimum value field (default: 0) to the value in the
Maximum value field (default: 1). You can specify the number of steps from the minimum value to the maximum value in the
Number of steps field (default: 5). From the
Mouse movement list, choose one of the following options:
•
|
Choose Distance (the default) to change the value when the user makes a linear mouse movement in any direction (vertical and horizontal movements are most stable).
|
•
|
Choose Circular to change the value when the user makes a circular mouse movement. Although a circular movement is how you move a physical knob, it is usually not the most convenient when using a mouse.
|
•
|
Choose Vertical to change the value when the user moves the mouse vertically.
|
In the Tooltip field, enter text that will appear as a tooltip when the user hovers the pointer over the knob.
In addition, the Settings window contains the following sections.
In this section, you specify the source for the data to control with a knob. The section contains a tree with a filtered view of the trees in the Application Builder and
Model Builder windows. The nodes either represent some sort of data or have children that do. For a knob, the data source can be variables in the COMSOL Multiphysics model and numerical (double and integer) variables that you define under
Declarations. The data display can show arrays or matrices with LaTeX syntax. You can extend the list of available data nodes by clicking the
Switch to Model Builder and Activate Data Access button (

) in the
Source section header, which takes you to the
Model Builder window, 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 data display objects.
When you select a node that represents data, the Use as Source toolbar button (

) below the tree becomes enabled. You can click it or, alternatively, press Enter, double-click, or right-click the node and choose
Use as Source to add it as the selected source. You can also click the
Create New Declaration and Use It as Source button (

) or the
Create New Form Declaration and Use It as Source button (

) in the
Source section header to create a new global or local (in the form) variable declaration for the data display 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 (if applicable). 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 Method list, select one of the following methods to specify the unit for the knob:
•
|
Append unit to number: The unit that you type in the Unit expression field is appended to the number corresponding to the knob’s position.
|
•
|
Append unit from unit set: The knob appends a unit from a Unit Set node added under Declarations (see The Unit Set Node). You specify the unit set to use from the Unit set list and the unit to use from Unit list, which lists all defined properties and their units from the select unit tests. There is also a No unit option.
|
Select the Custom label formatting check box to access the number format settings below.
In the Precision field, enter the number of significant digits to display in the label (default: 4). Choose the notation to use for the data from the
Notation list. The options are
Automatic (the default),
Scientific, and
Decimal. If you use
Automatic, the program switches to scientific notation when the output is about 3 orders of magnitude larger than or smaller than 1. For the
Automatic and
Scientific options, you can also choose the format of the exponent for scientific notation from the
Exponent list. The choices are
Power of 10 (the default) and
E-notation.
•
|
From the Horizontal alignment list, choose Left, Center, Right, or Fill, which automatically expands the form object to fill the cell in the horizontal or vertical direction (where applicable).
|
•
|
From the Vertical alignment list, choose Middle, Top, Bottom, or Fill, which automatically expands the form object to fill the cell in the horizontal or vertical direction (where applicable).
|
The need to specify the alignment is most obvious when working in the grid mode, as 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.
You can change the size of the knob using the Width field. The
Height field is unavailable because the knob object is always a square enclosing a circular disk (that is, the knob). The knob’s radius is set automatically by default. From the
Knob radius list, choose
Manual instead of
Automatic to specify a manual knob radius in the text field that appears below the
Knob radius list.
Additionally, in the sketch mode, you can specify the absolute position of the knob 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:
•
|
None, for no margin around the form object. This setting can be useful when displaying dynamical data inside a sentence to avoid excessive whitespace margins.
|
•
|
Custom, to specify the margins for the form object in the Horizontal and Vertical text fields.
|
From the Scale list, select an option for the appearance of the knob’s scale:
•
|
Choose None for no scale indication.
|
•
|
Choose Tick marks (the default) to indicate the scale using tick marks.
|
•
|
Choose Tick marks and labels to indicate the scale using tick marks and with labels for the minimum and maximum values.
|
•
|
Choose Tick marks and all labels to indicate the scale using tick marks and with labels for the minimum and maximum values as well as some other values between the minimum and maximum.
|
From the Knob main color and
Knob secondary color lists, select colors to use as the main and secondary colors on the knob’s surface:
Default (the default), any of the predefined basic colors, or
Custom, which makes it possible to select a custom color from a color palette.
From the Needle color list, select a color to use as the color for the knob’s needle:
Default (the default), any of the predefined basic colors, or
Custom, which makes it possible to select a custom color from a color palette.
From the Text color list, select a color to use for the text on the knob:
Inherit (the default; the form object then uses the setting from the Form object it is located in), any of the predefined basic colors, or
Custom, which makes it possible to select a custom color from a color palette.
From the Background color list, select a color to use as the background for the knob:
Transparent (the default), any of the predefined basic colors, or
Custom, which makes it possible to select a custom color from a color palette.
The font and the font size for the knob use the font settings from the Forms node by default. Select a font from the
Font list:
Default font or any of the available fonts. If needed, choose or enter a font size (in points) in the
Font size combo box. The default is to use the
Default size for the font.
You can also select the Bold check box to use a boldface font or the
Italic check box to use italics (an italic font).
Under State, you can control the initial state of the knob when users run the application. By default, the knob is visible and enabled. Clear the
Visible or
Enabled check box if you want to make the initial state so that the knob is hidden or unavailable. You can then make it visible or enable it using a method. In the Form Editor, the state of the form object is indicated by a change in its appearance. Objects that are hidden become visible when selected in the Form Editor.
You can specify a method or command sequence that the application runs when an event such as turning the knob occurs. The On data change list contains
None (the default) and any available methods or command sequence. You can add the following types of events by choosing from the
Create Global Method menu (

) to the right of the
On data change list:
•
|
Choose Create Global Method (  ) to create a global method. Type the name of the global method in the Name field of the Create Global Method dialog box that opens and then click OK. The global method is then added under Methods, and its Method Editor window opens.
|
•
|
Choose Create Form Method (  ) to create a form method. Type the name of the form method in the Name field of the Create Form Method dialog box that opens and then click OK. The form method is then added under the Methods node under the Form node, and its Method Editor window opens.
|
•
|
Choose Create Local Method (  ) to create a local method. Its Method Editor window opens.
|
•
|
Choose Create Command Sequence (  ) to create a command sequence using the Create Command Sequence dialog box that opens. There you can choose commands from the available Forms, GUI Commands, Declarations, Form Declarations, Methods, Form Methods, Libraries, and Model folders. To add a command, right-click the desired command node and choose the command to use ( Run, for example). The command then appears in the list of commands below. You can edit that command sequence using the toolbar buttons for moving and deleting commands below the table. Click the Convert to Method button (  ) and choose Convert to Method or Convert to Form Method to convert the command sequence to a method. Click the Go to Method button (  ) below the table to select the method in the Application Builder tree and open the method in a Method Editor window. For commands that include arguments, click the Edit Argument button (  ) to choose an argument in the Edit Argument dialog box that opens.
|
There can only be one local method and one command sequence so if you add one or both of them, the menu will instead contain Remove Local Method (

) and
Remove Command Sequence (

), respectively. Click one of them to delete the local method or command sequence.
The selected method in the On data change list then changes to the created method or command sequence. You can also Ctrl+Alt-click the knob object or right-click it to create a local method or (by choosing
Edit Method or
Edit Local Method) to open the method associated with the command. To open the selected method or command sequence, click the
Go to Source button (

). The focus then moves to the method’s editor window or the
Command Sequence dialog box, respectively.
By default, the Trigger while dragging check box is selected. The event is then triggered while dragging the knob. If the method that is connected to the event takes some time to run, the slider can appear to be sluggish. If you clear the
Trigger while dragging check box, the event is instead only triggered when you stop dragging and release the knob.