Define Palettes and Templates

Uniface provides a default set of templates and snippets, but you may prefer to define your own set.

Note:  You should not edit the Uniface templates because your changes may get overwritten if you import the defaults again in the future.

  1. Edit the ide.asn and set the logical ALLOW_BROWSE_TEMPLATES=1.

    This setting enables you to create, browse and open main development objects that have been defined as palettes.

  2. Start or restart the IDE after editing the assignment file.
  3. Create a new main development object of the desired type, such as a component or modeled entity. For more information, see Create a New Development Object.

    Tip: An easy way to create a new palette is to duplicate a default palette and modify it. To open an existing palette from the Resource Browser of the desired object editor, right-click a template and choose Open, or use the U-Bar to select an object type and then enter the word palette.

    Smart suggestions for default templates in the U-Bar.

  4. Set the object's Purpose property to one of:
    • P (Palette)—defines the object as a container of templates for subobjects.
    • T (Template)—defines the object as a template for a new main development object.

      If you create templates for main development objects, they should be added to a project that is defined as a palette. This ensures that they are visible in the Templates tab in the Project Editor.

    • If you are defining a palette for templates, create the subobjects that the palette should contain. Any subobject created in a palette is implicitly defined as a template.

      Note: The palette for component templates is a component, so you must create 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 named ENT.HIDDENINPALETTE. Any entity with the suffix HIDDENINPALETTE will not be shown in the Resource Browser.

  5. For each palette and template, provide a descriptive name in the Alternative Name property, and more information in the Description property.

    These properties are visible in the Resource Browser and are used for filtering and searching. The actual object Name is restricted in length and content and is shown in the Resource Browser.

  6. For each palette and template, set its properties and write script to suit your requirements.
  7. If necessary, compile the objects to check the ProcScript syntax.

    You can compile palettes and main development object templates individually using the Compile command.

    However, they are not compiled when compiling a project or during batch compilation from the command line or in ProcScript (for example, using /all or /cpt, or $ude("compile")). To explicitly compile templates and palettes from the command line, use the /tpl and /plt sub-switches.

    Compiling templates and palettes validates the ProcScript syntax but does not generate any runtime objects.

  8. When you have completed your set of palettes and templates, comment out or delete the ALLOW_BROWSE_TEMPLATES=1 line.

    This ensures than only normal development objects can be edited, and prevents palettes and templates from being used incorrectly.

You may want to configure the Uniface IDE to use your own templates as the defaults. To do so, set the appropriate logical in the ide.asn file. For more information, see Uniface IDE Logicals.

For example, to change the palettes used in the entity editor, set the following logicals:

[LOGICALS]
...
; Default palettes for Entity Editor:
EntityEditor_DefineStructure_ResourceBrowser_DefaultPalette = ent:ACME_ENTITY.ACME
EntityEditor_WriteScript_ResourceBrowser_DefaultPalette     = libsnp:ACME_PROCSCRIPT
...

Related Topics