The Application Builder Desktop Environment
The screenshot above is representative of what you will see when you are working with the Application Builder. The main components of the Application Builder desktop environment are:
The Application Builder desktop environment is also sometimes referred to as the Application Builder workspace.
The Application Tree
The application tree consists of the following nodes:
The Inputs node contains subnodes that are of the type Application Argument. These can be used for input arguments to the application when starting it from the command line of the operating system.
The Themes node has a Settings window with choices for the desktop color themes, as well as font, text color, and other settings that will affect the general appearance of an application.
The Main Window node represents the main window of an application and is also the top-level node for the user interface. It contains the window layout, the main menu specification, and an optional ribbon specification.
The Forms node contains subnodes that are forms or folders containing local forms, methods, and declarations. Each form may contain a number of form objects such as input fields, graphics objects, and buttons.
The Events node contains subnodes that are global events. These include all events that are triggered by changes to the various data entities, such as global parameters or string variables. Global events can also be associated with the startup and shutdown of the application. Timer events can be used to operate an app as a digital twin, enabling automated actions to be performed at regular intervals.
The Declarations node is used to declare global variables, which are used in addition to the global parameters and variables defined in the model.
The Methods node contains subnodes that are global methods. Methods contain code for actions not included among the standard run commands of the model tree nodes in the Model Builder. The methods may, for example, execute loops, process inputs and outputs, and send messages and alerts to the user of the application. Methods can modify the model object of a running application or the model object represented by the Model Builder in the current session. The latter being utilized when building an add-in.
The Libraries node contains images, sounds, and files to be embedded in an MPH-file so that you do not have to distribute them along with the application. In addition, the Libraries node may contain Java® utility class nodes and nodes for external Java® and C libraries.
The Form Editor
Use the Form Editor for user interface layout by creating forms with form objects such as input fields, graphics, and buttons.
The main components of the Form Editor are:
Creating a New Form
To create a new form, right-click the Forms node of the application tree and select New Form. You can also click New Form in the ribbon. Creating a new form will automatically open the Form Wizard with a number of layout templates.
If your application already has a form, for example form1, and you would like to edit it, you can open the Form Editor in either of two ways:
Note: Single-clicking a form node in the application tree displays a preview of the form’s layout definition, whereas double-clicking allows you to edit the form.
You can also add forms that are local to other forms. When applicable, this option is available as a menu option from the New Form button or the application tree.
The Main Window Editor
Use the Main Window Editor for menu and ribbon layout by creating menus with menu items and ribbon tabs with ribbon items. In addition, the Main Window Editor, available directly from the Main Window node, is used for subwindow layout.
The main components of the Main Window Editor are:
The Method Editor
Use the Method Editor to write methods for actions not covered by the standard use of the model tree nodes. A method is another name for what is known in other programming languages as a subroutine, function, or procedure.
The main components of the Method Editor are:
Creating a New Method
To create a new global method, right-click the Methods node in the application tree and select New Method. You can also click New Method in the ribbon Home tab. In the New Method dialog you can change the name of the method.
Creating a new method will automatically open the Method Editor. Methods created under the main Methods node in the application tree are global methods and accessible from all methods, form objects, and from the Developer tab in the Model Builder ribbon.
You can also add methods that are local to a form, also known as form methods. When applicable, the option to create local form methods is available from the New Method button's menu or by first clicking a form node in the application tree.
Furthermore, you can add methods that are local to individual form objects, also known as local methods (see Using Local Methods and Local Methods).
A sequence of commands associated with, for example, a button or menu item can be automatically converted to a new method by clicking Convert to Method. Open the new method by clicking Go to Method. You can also create a method that is local to a form or form object by clicking Convert to Form Method or Convert to Local Method, respectively. These options are shown in the figure below.
If a method already exists, say with the name method1, then you can open the Method Editor in any of these ways:
In the application tree, right-click the method1 node and select Edit.
Below the command sequence in the Settings window of a form object, menu item, ribbon item, or an event, click Go to Method.
In the Events section of a form object, click Go to Source.
Application Builder Preferences
To access Preferences for the Application Builder, choose Preferences from the File menu and select the Application Builder node.
You can configure the COMSOL Desktop environment to display the Application Builder in a separate desktop window. To do this, select the Use separate desktop window for Application Builder checkbox. This configuration is particularly useful if you are using multiple displays.
You can use the keyboard shortcuts Ctrl+Shift+M and Ctrl+Shift+A to switch between the Model Builder and Application Builder, respectively.
You can set an upper limit to the number of open Form Editor or Method Editor window tabs. Select the Maximum number of editors before closing checkbox and edit the number (default 15). Keeping this number low can speed up the loading of applications that contain a large number of forms.