学习中心

Course:

Getting Started with Building Simulation Apps

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 thesimplified thermal microactuatortutorial model, which a simulation app was developed forpreviously. 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 theCreate Reportbutton. This is done through creating a dialog box and making it accessible through a button in the app. TheData Accessfeature is used to make the output format setting in the model tree available in the app; aCombo boxform object allows you to choose from the list of output formats; and aButtonform 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 newItemin the app ribbon
  • Creating a new form for a dialog box
    • Using theBlank formlayout template
    • Using theRows & Columnsbutton
  • Accessing model tree settings in dialog box form
    • Using theData Accessfunctionality
  • Designing the dialog box
    • Using theEditor Toolswindow
    • Using theInputoption to add aCombo box
  • Storing changes in a dialog box and closing it
    • Creating a newButtonform object
    • EditingText,Style, andDialog Actionssettings
    • UsingPreview Formfor tests
  • Showing the form as a dialog box
    • Selecting the form under theChoose Commands to Runsection
    • TheShow as Dialogcommand
  • Testing the app

Further Learning

TheIntroduction to the Application Builderdocumentation 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.


请提交与此页面相关的反馈,或点击此处联系技术支持

Baidu
map