File Import
The File Import () is a special form object for browsing and choosing files to import that the application can use for some purpose (providing data input, for example). You can also add files to a file library in the Application Builder (see The Libraries Branch for more information). Enter the name of the file import object in the Name field.
Enter a text to appear on the button for browsing in the Button text field.
Enter a title for the file import dialog in the Dialog title field. The dialog title is also the tooltip of the button.
In the File types list, add the types of files that the file browser should display. Click the Add button () to open a dialog box with a list of file types and their associated extensions, which you can add to filter the list of files to display in the browser.
Use the Move Up (), Move Down (), and Delete () toolbar buttons to organize and remove commands from the list.
By default, the Allow entering file name check box is selected so that users can type in a filename in the browser in addition to selecting a file from the list of matching files.
In addition, the Settings window contains the following sections.
File Destination
This section contains a tree with a filtered view of the trees in the Application Builder and Model Builder windows. The nodes either represent some sort of file destination or have children that do. The list contains, under Declaration, File nodes that you declare. It also contains settings under Model that support browsing for files. Such a setting is typically a text field with a Browse button that you find in the Interpolation function and geometry Import nodes, for example. In the tree, it appears as a Filename subnode (for example, under an Interpolation node). When you select a node that represents a file destination, the Use as source toolbar button () below the tree becomes enabled. You can also right-click the node and choose Use as source. After selecting a node as the source, the node appears as the selected source underneath Selected source. The file scheme for accessing the file appears next to Access using. For an Interpolation node with the tag int1, for example, the scheme is upload:///int1/filename. You can also click the Create New File and Use It as Source button () in the File Declaration section header to create a new variable declaration and use it as the file destination. A Create and Use File dialog box opens, so that you can specify the filename. The name cannot be in conflict with any existing filename. Click the Edit Node toolbar button () below the tree to move to the corresponding node. If necessary, the program switches to the Model Builder.
Position and Size
This section contains all layout settings for a file import object in the grid of the parent form.
In the grid mode, you can control the horizontal and vertical alignment of the file import object 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 file browser. 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 value is determined by the software.
Additionally, in the sketch mode, you can specify the absolute position of the file browser 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
Appearance
In this section, you can control the appearance of the background and the text in the file import object:
From the Text color list, select a color to use for the file import object’s text: Inherit (the default; the form object then uses the setting from the Form it is located in), any of the predefined basic colors, or Custom, which makes it possible to select a custom color from a color palette.
From the Background color list, select a color to use as the background in the file import: Transparent (the default), any of the predefined basic colors, or Custom, which makes it possible to select a custom color from a color palette.
The font and the font size for the text 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 font size is Default size.
You can also select the Bold check box to use a boldface font or the Italic check box to use italics (an italic font).
Under State, you can control the initial state of the file import object when users run the application. By default, the file import object is visible and enabled. Clear the Visible or Enabled check box if you want to make the initial state so that the file import object is 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.
Events
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 file import object support a string argument with the new client file name selected by the user. You can also right-click the file import object to create a local method or (by choosing Edit Method or Edit Local Method) to open the method associated with the command.
When you Ctrl+Alt-click the file import object:
If the On data change list is set to a method, the method’s editor window opens.
If the On data change list is set to None, it creates a local method (if needed), sets the list to Local method, and opens the local method’s editor window.
For events triggered by data change, the event is triggered after the new data value is stored in the data source.