Templates and Palettes

Templates are development objects that are copied during development to create new objects. Uniface provides an extensive set of default templates, but you can also create your own.

Uniface Templates

When the Uniface IDE is started for the first time (with an empty Repository), a set of templates must be loaded into the Repository. You can load the default templates provided by Uniface, or load your own set of templates.

The default templates ensure that you can create new objects, but they also serve as object and code examples. Each template sets some properties or provides default code that ensures that the object created with the template works appropriately, out-of-the-box. Of course, once you have created the new object, you can edit its properties and code to suit your own requirements. For more information, see Uniface Default Templates.

Logicals in the assignment file of the Uniface IDE (ide.asn) determine the default template collections used for each type of development object. For more information, see Uniface IDE Logicals.

Using Templates

During development, you can select templates from the Templates tab in the Resource Browser, and insert them into the main development object you are creating. This creates a copy of the template object, with the same properties, script, and subobjects (if applicable). The new object can then be renamed and edited to suit your requirements.

For example, a template for a Date field specifies the Date data type, as well as the field interface, input format, and display layout properties. By using this template, you ensure that all Date fields are consistent, and you save time by not having to set properties individually.

Templates Tab with Field Templates

Templates tab in the Resource Browser of the Entity Editor

  1.  A collection of templates is delivered in a palette. In this illustration, templates for modeled fields are delivered in an modeled entity palette called UPALETTE_ENT.U. You can use the U-Bar in the Resource Browser to navigate to a different palette of templates or filter the contents of a palette.
  2.  The templates themselves are listed in the Resource Browser.
  3.  To create an object using the template, you can drag and drop it onto an object in the center pane, or select an action from context menu.


A palette is a main development object, such as a component or modeled entity, that contains templates for subobjects that belong to the main object. For example, a component palette can contain templates for component entities and fields, a modeled entity palette can contain templates for fields and sub-entities, and a project template contains templates for main development objects.

The difference between a normal development object and its equivalent template or palette is the value of its Purpose property. Templates and palettes have their Purpose property set to T (template) or P (palette). Normal objects have their Purpose set toN (Normal).

By default, the Purpose property is not visible in the Uniface IDE, and it is also not possible to edit palettes and templates. This ensures that these templates cannot be modified by accident, and that they are not mixed in with your own development objects when browsing for objects.

To make it possible to create and edit your own templates, you must first set the logical ALLOW_BROWSE_TEMPLATES=1 in the ide.asn assignment file before starting the Uniface IDE. For more information, see Define Palettes and Templates.

Objects that are defined as palettes are immediately available for use in the Resource Browser of the appropriate editor. Any object that is created in a palette is automatically defined as a template.

Note:  By default, snippet libraries are defined as palettes to ensure that the snippets they contain are available in the Snippets tab of the Resource Browser . For more information, see Snippets.

Palettes for Components

When defining the structure of a component, the default palette displayed in the Templates tab of the Resource Browser is called UPALETTE_XXX; for example UPALETTE_DSP for dynamic server pages. Its contents comprise non-database entities, and various field definitions, including component-specific widgets.

The palette for component templates is itself a component, so it has a component structure with at least one entity to serve as a container for the other templates. This structure is ignored when the templates are displayed in the Resource Browser.

In the default templates, the container entity is not visible in the Resource Browser. This is because it has the name ENT.HIDDENINPALETTE and any entity with the suffix HIDDENINPALETTE is not shown in the Resource Browser. This also applies if you define your own palettes for component templates.

UPALETTE_FRM for Form Templates
U_PALETTEFRM for entity and field templates in Form components

Related Topics