The Toggle Button node (

) adds a toggle button beside a user input or selectable input.
To add a Toggle Button node, right-click a
User Input or
Selectable Input node and select it from the
Buttons menu. You can right-click the
Toggle Button node to add an
Activation Condition or
Input Dependency subnode.
The Settings window has the following sections:
If the Command type is set to
Internal action tag (the default), you enter a tag for the action in the
Action tag field.
If the Command type is set to
Command handler from code editor, you determine the source using the
Links from list. Available options are:
Enter a title of the button in the Title field and an icon file in the
Icon field or click
Browse (

) to pick an icon file from the file system.
The Weight field contains a factor (an integer number) that can be used to decide the order of the items in a context menu. It is available (editable) when the
Menu items ordering list is set to
Use weighting order in the Settings window for a
Context Menu node. Under a toolbar menu, the weight is always 0 and this field is not editable.
Select the Record a custom COMSOL API command checkbox and type a name for using an API call equivalent to clicking the button as
runCommand(<name>), where
<name> is a string with the name that you enter in the
Command field.
Select the Use button style if possible checkbox if desired. This setting is only available for a button under a user input. It uses the style of a button instead of just text.
Select the Always show the title checkbox to always display the title. It is selected by default if you use the button style.
Select the Default selected checkbox if you want the toggle item to be selected (turned on) by default.
Select the Show confirmation dialog checkbox if you want to display a confirmation dialog as a preaction for the toggle item’s action. Type a message for the confirmation dialog in the
Message field and a confirmation answer in the
Answer field (default:
Yes). The confirmation dialog also contains a
Cancel button by default. You can use this functionality to ask for confirmation before performing the action.