Introduction
We have been creating new content all through this course, and have seen how shared styles can be used to manipulate the look and feel of items added to a screen. Templates allow us to take this reusability further by allowing us to create completely new layouts which can be reused, such as buttons or containers.
Create the Item to Template
First, we create the item we want to configure, then we can turn it into a template.
- Open the Companies List Screen.
- From the Palette → Buttons - Secondary section, add a Custom - Icon button to the left of the edit button.
-
- We need to configure the button to open the Invoicing screen. We could manually create the actionflow, but a shortcut is to drag the screen from the repository onto the button.
- Click the
Insert excerpt |
---|
| _screen |
---|
| _screen |
---|
nopanel | true |
---|
|
button from the toolbar. - Drag Invoicing onto the Orders button.
- If you simply drag a screen from the repository onto an open screen, a button will be created along with an actionflow to open the screen.
- Change the Orders button icon to the IconFinance image.
- Lock your screen and check the new button opens the Invoicing screen.
Create a Template
With the item now created we can turn it into a template:
Insert excerpt |
---|
| _unlock |
---|
| _unlock |
---|
nopanel | true |
---|
|
the screen.- Select the Orders button
- When creating a template ensure you have the outermost area of the thing you want to make a template.
- With the item highlighted in the Layers section, right-click and select
Insert excerpt |
---|
| _template_copy |
---|
| _template_copy |
---|
nopanel | true |
---|
|
- The properties for the new template open on the right.
- A copy of the button is taken and placed in the
Insert excerpt |
---|
| _template |
---|
| _template |
---|
nopanel | true |
---|
|
section under your application in the repository.
- Give the template a useful name e.g. Open Orders
- your changes.
Using a Template
- In the Repository, expand your application.
- Scroll down to the
Insert excerpt |
---|
| _template |
---|
| _template |
---|
nopanel | true |
---|
|
section and expand it. - Now you can drag this item onto a screen and a copy of its configuration is made.
tipTemplate Naming Conventions
When adding new components to a screen via a
Insert excerpt |
---|
| _template_singular |
---|
| _template_singular |
---|
nopanel | true |
---|
|
, child objects are given unique names based on the parent and all expressions in the copied template are adjusted to use these names. This only applies to input form fields and buttons in the following way:Form Fields- The label value is set to the name of the parent.
- The inner input field takes the same name as the parent.
ButtonsIf a button is embedded in a template, where its Buttons
- When a button is added to a screen from a template, if the button name is prefixed with the name of the template parent,
when the button is added to the screen the parent name prefix is - this is updated to match that of the new parent
. if an area - a template area, called "FooArea", with a button inside
. The area is called FooArea and the button is called . dragged onto a screen the user is asked to give it a name, if the call it - added to a screen and named "bar", the area will be called "bar" and the button will be called "bar_Button
. Deleting Templates
If you have used a
Insert excerpt |
---|
| _template_singular |
---|
| _template_singular |
---|
nopanel | true |
---|
|
to create a screen(s), the template can be deleted and will not affect the screen created from it.