Working With Forms > The Form Objects > Array Input

Array Input
The Array Input () is a predefined form object with an input table to enter array inputs (vector inputs). The Array Input supports arrays as data sources. You can add an optional label, symbol, and unit. Enter the name of the Array Input object in the Name field.
In the Length field, enter the length of the array as a positive integer (default: 3). The maximum length is 1000.
From the Show vector as list, choose Table (the default) to show the array components as a table, or choose Components to show each array component as a separate input field with a label.
In addition, the Settings window contains the following sections:
Source
In this section you select the source for the array input. The section contains a tree with a filtered view of the tree in the Application Builder window. The nodes either represent some sort of data or have children that do. For an array input, the list contains array variables defined under Declarations, for example. When you select a node that represents data, the Use as Source toolbar button () below the tree becomes enabled. You can also right-click the node and choose Use as Source. You can also click the Create button () in the Source section header to create a new variable declaration and use it as the source. A Create and Use Variable dialog box opens, so that you can select the data type of the source (if applicable), its name, and its initial value. The name cannot be in conflict with any existing variable declaration. Click the Edit Node toolbar button () below the tree to move to the corresponding node. If necessary, the program switches to the Model Builder.
After selecting a node as the source, the node appears as the selected source under Selected source.
From the Initial values list, select From data source (the default) to use the value specified by the selected data source, or select Custom values. Then in the associated table below, enter the initial values for the components in the array.
Layout Options
This section provides settings for adding optional labels and units to the array input.
Use the Label position list to place a label. The options are Above (the default), Left, and No label. For the two first options, you can enter the desired label in the Label text field.
When the label position is above the table, you can include a symbol to the left of the table by selecting the Include symbol check box. You cannot see this setting when the label position is to the left of the table as it overlaps with the symbol position. Enter the symbol using LaTeX syntax in the Symbol (LaTeX encoded) field.
As a final option, select the Include unit check box to add a unit symbol to the right of the table. To add a unit, choose a corresponding physical quantity from the From physical quantity list or enter a valid unit expression in the SI unit field under the list when its value is None.
If you choose to display the array input as components, the Label text field changes to a Component labels table with one row for each of the component’s labels. Likewise, the Symbol (LaTeX encoded) field changes to a Component symbols table with one row for each of the component’s symbols.
Position and Size
This section contains all layout settings for an array input in the grid of the parent form.
In the grid mode, you can control the horizontal and vertical alignment of the array input 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 array input. 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 input field is determined by the software.
Additionally, in the sketch mode, you can specify the form object’s absolute position 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, to use 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.
Appearance
In this section, you can control the appearance of the background and the text in the array input:
From the Text color list, select Inherit (the default) to inherit the text color from the setting in the Form node, or select one of the predefined colors, such as Black. Select Custom to choose a custom text color from the color palette that opens.
From the Background color list, select a color to use as the background in the array input: Transparent (the default), any of the predefined basic colors, or Custom, which makes it possible to select a custom color from a color palette that opens.
The font and the font size for the text in the array input fields use the font settings from the Forms node by default. Select a font from the Font list: Default font or any of the available fonts. If needed, choose or enter a font size (in points) in the Font size combo box. The default is to use the Default size for the font.
Select the Bold check box to use a boldface font.
Select the Italic check box to use italics (an italic font).
Under State, you can control the initial state of the array input when users run the application. By default, the array input is visible and enabled. Clear the Visible or Enabled check box if you want to make the initial state so that the array input is hidden or unavailable. You can then make it visible or enable it using a method.
Events
For certain types of form objects, you can specify a method to run when an event such as data entry occurs. The On data change list contains None (the default) and any available methods. To add a local method for the event, click the Create Local Method button () to the right of the On data change list, or right-click the file import object. The selected method in the On data change list then changes to Local method. To open the local method in a method editor window, click the Go to Source button (). An empty onDataChange editor window then opens, where you can define the local method. (This window opens automatically when you first create a local method this way.) Click the Remove Local Method button () to delete the local method. Methods called from the array input object support a string argument with the new client file name selected by the user.
For events triggered by data change, the event is triggered after the new data value is stored in the data source.
You can also Ctrl+Alt-click on the array input object.
If the On data change list is set to a method, Ctrl+Alt-click opens that method’s editor window.
If the On data change list is set to None, Ctrl+Alt-click creates a local method if needed, sets the list to Local method, and opens the local method’s editor window.