The Tree control is an input control that displays a hierarchical list of information. Each node can have sub nodes and can be expanded to reveal these sub nodes and collapsed to hide sub nodes. The nodes can typically represent headings in a document, the entries in an index, or the files and directories in a file manager application. Parent nodes (nodes that contain other items) are called categories and child nodes are called items. Each node consists of a label and an image that can be customized. This control can be used to:
Single or multiple items can be selected at runtime according to the configuration of the control. These items can be used when executing rules, for example calling a Save or Load method for all the items selected in a tree view.
The following image shows a simple Tree control with a root node, an expanded node, and a collapsed node. The Multiple option has also been enabled for the selection type property of the control to allow multiple items to be selectable:
When creating a SmartObject or editing an existing SmartObject for use with the Tree control, the following need to be considered:
See the following sections for more detail on using single or multiple data sources:
How to use a single data source
How to use multiple data sources
Below is an example of a SmartObject used with the Tree control, followed by a screenshot showing the behavior of the Tree at runtime based on the values entered for the SmartObject. This example is using a single data source. Note the color-coded links between the ID and Parent ID. Since Vehicles has a Parent ID of 0 and it is the only item with Parent ID 0, it is the Root Node of the Tree View. Cars and Motorcycles have a value of 1 for the Parent ID and therefore appear as sub-nodes under Vehicles. Car 1, Car 2 and Car 3 have 2 as the value of their Parent ID, and therefore they will appear under Cars in the tree view.
The Tree control can interact with other controls through rules. Depending on the control properties, there are certain actions where the control surfaces. Following are a few examples:
The following Rule events are available when using the Tree control:
The following Rule methods are available when using the Tree control:
The Tree control is available in the Input section of the Controls toolbox.
Property | Description | Can be set at runtime using Rules |
---|---|---|
Detail | ||
Name | A unique identifier for the selected control. This property is required. | No |
Field | The field that is bound to the selected control. | No |
Type | A drop-down list containing the types of values that the control can accept. | No |
Watermark | The text to display when the control is not populated. | Yes, see Control Properties Actions for more information |
Tooltip | The value to be displayed when the cursor is hovered over the control during runtime. | Yes, see Control Properties Actions for more information |
Settings | ||
Selection Type | The type of selection allowed at runtime. Single or Multiple items can be selected. | No |
Delimiter | The type of delimiter to be used when saving the values. The default is ";". | Yes, see Control Properties Actions for more information |
Path Separator | The Path Separator property is used to separate each value node concatenated from the root to the selected node. This is called the Value Path. | Yes, see Control Properties Actions for more information |
Expanded | When the View is opened at runtime the tree will be expanded. | Yes, see Control Properties Actions for more information |
Save as XML | Saves the tree information in XML format. | No |
Data Source | ||
Data Source | The selected SmartObject that has been bound to the control. See Configure Data Source section. | No |
Icon Source | The selected SmartObject that contains the image used for the icon. See the Using a custom icon section. | No |
Icon ID | The property used to identify the ID of the icon contained in the SmartObject. See the Using a custom icon section. | No |
Icon Image | The property used to identify the image of the icon contained in the SmartObject. See the Using a custom icon section. | No |
Icon Name | The property representing the name of the image. See the Using a custom icon section. | No |
General | ||
Height | Adjusts the height of the control. Any whole number or pixel value up to 32767px. When set to zero, it will automatically change the size to fit the content of the page. Type the dimension to be used. | Yes, see Control Properties Actions for more information |
Width | Adjusts the width of the control. Any whole percentage up to 100%, whole number or pixel value to a maximum of 32767px can be entered. Type the dimension to be used. | Yes, see Control Properties Actions for more information |
Visible | Shows or hides the control at runtime. | Yes, see Control Properties Actions for more information |
Enabled | Enables or disables the control at runtime. | Yes, see Control Properties Actions for more information |
Read-Only | Used to establish whether the control is read-only during runtime. | Yes, see Control Properties Actions for more information |
Styles | Opens the Style Builder enabling the user to specify style features like Format, Font, Borders, Padding and Margins. See the Style Builder topic for more information on styling options | No |
Conditional Styles | Opens the Conditional Formatting Designer. This is used to design styles that will apply only when certain conditions are met. See the Conditional Styles section for more information. Click on the ellipsis to open the Conditional Formatting screen. | No |
When clicking on the ellipsis next to Data Source, the Configure Data Source screen opens. Configure the data source to be used for the control. A single or multi-source can be configured. When clicking on the ellipsis next to Method on the Configure Data Source screen, the Populate Tree List Control with Data screen opens. The Tree control's input properties can be set by using fields or parameters. Filters and sorting can also be applied to the results that will populate the Tree control. It is advised that a very strict filter is set up to limit the number of items used to populate the Tree control. See the Filter and Sort sections for a detailed description and items that need to be considered when applying these.
A single SmartObject can be used to populate the Tree control. An image can be used as an icon to differentiate between the different categories and items. Images can be contained within the SmartObject used as the data source or it can be a separate SmartObject. When using a single SmartObject, it is important to have the data set up correctly for it to display as expected in the Tree control. See the Creating SmartObjects section for specific requirements and an example of what the data should look like.
Field | Description |
---|---|
SmartObject | The SmartObject to be used to populate the control. Click the ellipsis next to SmartObject to select the SmartObject. |
Method | The method to be used to populate the control. This can only be a list type method. |
Display | The display value for the tree node. The display can be customized by clicking on the ellipsis and dragging fields across from the Context Browser. |
ID | The identifier of the SmartObject. One can also transfer the Path (which is recorded as ID,SmartObject) to or from the Tree control and the configured ID and SmartObject name would then be used. The ID is by default the Autonumber ID but can be changed to any field in the SmartObject. |
Value | The SmartObject property to be used as the value for the control. The Value of the node when selected, will be the value returned from the property selected in the Data Source screen. |
Parent SmartObject | The parent SmartObject to be used to build the relationship between the parent and child SmartObjects. |
Parent Property | The parent property to be used when linking the child SmartObject to the parent SmartObject. |
Field | Description |
---|---|
None | No icon applied. |
Static | Static list of icons available. Select an icon from the list. |
Dynamic | The property of type Image that provides the icon to be used. |
Multiple SmartObjects can be used to populate the Tree control. An image can be used as an icon to differentiate between the different categories and items. Images can be contained within the SmartObject used as the data source or it can be a separate SmartObject. When using multiple SmartObjects as the data source, associations between the SmartObjects can be useful to populate the Tree control. If associations are not used, the subsequent SmartObjects will need a field linking them to their parents (as with cascading controls).
Following is an example of how the associations will be created for this specific scenario and how it will be displayed in the tree.
Province:
ID: Autonumber type property used to identify the Province .
Province: Text type property used for the name of the Province.
City:
ID: Autonumber type property used to identify the City.
Province FK: Number type property used to associate the Province and City SmartObjects.
City: Text type property used for the name of the City.
Field | Description |
---|---|
SmartObject | The SmartObject to be used to populate the control. Click the ellipsis next to SmartObject to select the SmartObject. |
Method | The method to be used to populate the control. This should be a list type method. |
Display | The display value for the tree node. The display can be customized by clicking on the ellipsis and dragging fields across from the Context Browser. |
ID | The identifier of the SmartObject. One can also transfer the Path (which is recorded as ID,SmartObject) to or from the Tree control and the configured ID and SmartObject name would then be used. The ID is by default the Autonumber ID but can be changed to any field in the SmartObject. |
Value | The SmartObject property to be used as the value for the control. The Value of the node when selected, will be the value returned from the property selected in the Data Source screen. |
Parent SmartObject | The parent SmartObject to be used to build the relationship between the parent and child SmartObjects. |
Parent Property | The parent property to be used when linking the child SmartObject to the parent SmartObject. |
Field | Description |
---|---|
None | No icon applied. |
Static | Static list of icons available. Select an icon from the list. Per SmartObject, you will only have one icon. A specifically chosen image will be used to display at runtime. (In the background the static icon selected will still be retrieved via selected Icon ID property in the properties grid of the control) |
Dynamic | The property of type Image that provides the icon to be used. This contains the properties of the current source. At runtime, the selected property source will be used as lookup value against the Icon ID property that was chosen. |
When you drop a Tree control for the first time, the Tree control will attempt to bind to a system defined SmartObject called Tree Icons. (System Name: SourceCode_Forms_SFTreeIcons)
This SmartObject contains the following icons:
Auto-binding will happen when the Tree control is dropped for the first time. If the icon source is removed, the View is closed and opened again, it will not auto-bind the SmartObject again.
Icon Options
None - No icon is displayed.
Static - A specifically chosen image will be used to display at runtime. (In the background the static icon selected will still be retrieved via selected Icon ID property in the properties grid of the control).
Dynamic - This contains the properties of the current source. At runtime, the selected property source will be used as lookup value against the Icon ID property that was chosen.
Icon Selection behavior
Icons can be applied on the various levels of the categories and items. To do this, open the data source, navigate to the Icon tab and select one of the options. The icon will be applied on the level that is selected on the left hand side of the screen. So if the City is selected in the example below, the icon will be applied on City level.
A custom icon can be used for the different nodes in a Tree control. An image can be used to differentiate between the different categories and items. Images can be contained within the SmartObject used as the data source or it can be a separate SmartObject.
Properties | Description |
---|---|
Icon Source | SmartObject containing the image. |
Icon ID | The property used to identify the ID of the icon contained in the SmartObject. |
Icon Image | The property used to load the image contained in the SmartObject. |
Icon Name | The property representing the name of the image. |
When using a rule action to set the properties of the Tree control, the following should be noted:
For each node, the Path contains the ID property value, and then the system name of the corresponding source.
Video | Links | Learn | Support |
No videos found for this article K2 on YouTube
No Additional links found for this article
No self-learning content for this article Try some scenarios...
No relevant support links available for this article
|