How to Add a Dialog Box to Your Simulation App
When developing simulation apps with the Application Builder in COMSOL Multiphysics®, you can add dialog boxes to the app. Examples of use cases include, but are not limited to, a:
- Confirm box — confirm an action or choice selection made in the app before an operation commences
- Inputs box — enter a value to specify a quantity
- Warning/error message box — stop execution of an operation and provide context as to why and how to resolve
Here, you will learn how to implement a dialog box to support the use of your app.
Tutorial: Creating a Dialog Box
The example used here is the simplified thermal microactuator tutorial model, which a simulation app was developed for previously. Here, the app is extended by enabling you to choose the output format for a report file of the model before generating the report via the Create Report button. This is done through creating a dialog box and making it accessible through a button in the app. The Data Access feature is used to make the output format setting in the model tree available in the app; a Combo box form object allows you to choose from the list of output formats; and a Button form object enables a user to store changes and close the dialog box. A new form is created to implement this functionality to the existing app structure. Topics covered in the tutorial video include the following:
- Adding functionality to prompt a dialog box
- Adding a new Item in the app ribbon
- Creating a new form for a dialog box
- Using the Blank form layout template
- Using the Rows & Columns button
- Accessing model tree settings in dialog box form
- Using the Data Access functionality
- Designing the dialog box
- Using the Editor Tools window
- Using the Input option to add a Combo box
- Storing changes in a dialog box and closing it
- Creating a new Button form object
- Editing Text, Style, and Dialog Actions settings
- Using Preview Form for tests
- Showing the form as a dialog box
- Selecting the form under the Choose Commands to Run section
- The Show as Dialog command
- Testing the app
Further Learning
The Introduction to the Application Builder documentation includes numerous examples of dialog boxes being used in different apps. You can also find more information in the "Showing a Form as a Dialog Box" section.
Submit feedback about this page or contact support here.