Progress Bar
The Progress Bar () form object adds a progress bar to a form in an application. The progress bar can show progress based on a value that describes some progress in a running application using a method that updates the progress bar. You control the update and display of the progress in the progress bar by referring to the name that you enter in the Name field. For example, add the following two lines of code in a Method Editor window:
startProgress("progressbar1");
setProgress("progressbar1", 12);
The first line starts progress for the progress bar object with the name progressbar1. The second line updates its progress to 12%. You can find a full listing of the available commands for controlling the progress under User interface>Progress in the Language Elements window, accessible in the Code section of the Method ribbon toolbar. You can also base the progress on the built-in model progress (the main progress in COMSOL Multiphysics) by selecting the Include model progress check box. Optionally, it is then possible to use two levels of progress. Select Two from the Progress levels list (default: One) to use two levels of progress (represented using two progress bars).
Select the Cancel button check box to add a Cancel button underneath the progress bars to make it possible to cancel some progress in the application.
If the Cancel button check box is selected, you can select or clear the Close dialog when canceled check box. If that check box is selected, dialog forms are closed when a user clicks the Cancel button.
A third option is to add a progress dialog for the application’s own progress using available methods such as startProgress(progressBarname), setProgress(int workDone), and closeProgress(). See the full list of Application Builder methods in the Introduction to the Application Builder document.
The Settings window contains the following sections.
Appearance
Under Appearance, you can control the initial state of the progress bar when users run the application. By default, the progress bar is visible and enabled. Clear the Visible or Enabled check box if you want to make the initial state of the progress bar 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.
Position and Size
This section contains all layout settings for a progress bar in the grid of the parent form.
In the grid mode, you can control the horizontal and vertical alignment of the progress bar using the following lists:
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 form windows. 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 also specify the width of the progress bar. Enter a width (in points) in the Width field. If you have chosen Fill from the Horizontal alignment list, you can instead specify a Minimum width. Choose Automatic to compute the minimum width automatically (typically, this means a minimum size of 0) or choose Manual to specify a minimum width in the text field underneath. The Height field is unavailable because the height of the progress bar is determined by the software.
Additionally, in the sketch mode, you can specify the absolute position of the progress bar 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.
Cell Margin
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
From parent form (the default), to use the margins set for the parent form
Custom, to specify the margins for the form object in the Horizontal and Vertical text fields