ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or website / Controls, windows and pages / Window template
  • Overview
  • Creating a window template
  • Creating a window template
  • Creating a window template from an existing window
  • Applying a window template
  • Creating a new window based on a window template
  • Applying a template to an existing window
  • Remarks
  • Opening the template associated with a window
  • Applying the modifications performed on a template
  • Testing a window template
  • List of templates used
  • Synchronizing the windows and the window templates
  • Example
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Overview
WINDEV and WINDEV Mobile allow you to create window templates. These templates contain the graphic elements and code common to all the windows in your application.
Changes made to a window template are automatically applied to all the windows that use the template.
Window templates allow you to keep the style book defined for an application.
Using window templates in your applications allows you to:
  • create windows more easily.
  • set the layout of the windows.
  • easily update the application style book.
Creating a window template
A window template can be created:
  • directly, like any other window.
  • from an existing window.

Creating a window template

To create a window template:
  1. Create a new window template:
    • Click in the quick access buttons.
    • The new element window appears: click "Window" then "Window template".
  2. You can:
    • Create a blank window template (based or not on the skin template used by the project),
    • Create a blank window template based on a skin template other than the one of the project,
    • Create a window template based on another window template of the project, if your project already uses window templates. In this case, you will have the ability to perform cascading updates of the window templates.
  3. The window editor displays a new window within an orange frame with the "Window template" title.
  4. Create all the necessary controls. These controls will be included in all the windows that use the template.
  5. If necessary, enter the WLanguage code corresponding to:
    • events associated with the window.
    • events associated with the different template controls.
      These events and their WLanguage code will be automatically imported into the windows that use the template.
  6. Give your template a name ("General" tab of the description window).
  7. On the "Home" tab, in the "General" group, click "Save" (or click in the quick access buttons).
The window template is a file with the ".WDT" extension.

Creating a window template from an existing window

To create a window template from an existing window:
  1. Open the window chosen as template.
  2. Keep the controls required by the template. These controls will be included in all the windows that use the window template.
  3. Keep only the code of the events required by the template. These events will be automatically imported into the windows that use the template.
  4. Give a name to your window ("General" tab in the description window of the window).
  5. On the "Home" tab, in the "General" group, click "Save" and select "Save as template". The current window becomes a template:
    • its name is preceded by "Template".
    • an orange border appears around the window in the window editor.
    • the window template appears in the "Project explorer" pane, under "Window templates".
The window template is a file with the ".WDT" extension.
Applying a window template

Creating a new window based on a window template

To create a new window based on a window template:
  1. Create a new window:
    • Click in the quick access buttons.
    • The new element window appears: click "Window" then "Window".
  2. In the wizard, select the "Based on a template" pane.
  3. Choose your template from the list of available templates.
  4. Validate. The new window is displayed in the editor.
A yellow square highlights the elements that belong to the window template. These elements can be modified:
  • in the window template: the modification will be effective for all the windows that use this template.
  • in the window, via the mechanism for "control override": the modification will be effective for the window only.

Applying a template to an existing window

To apply a template to an existing window:
  1. Display the window in the window editor.
  2. On the "Window" tab, in the "Templates" group, expand "Templates" and select "Inherit from a template".
  3. Select the window template to apply.
  4. Validate.
  5. Specify whether you want to update the properties of the window from the template.
    If you answer "Yes", the list of properties to override is displayed. In this window, you have the ability to select the properties of the initial window to keep. For each selected property, the values from the template will be overridden with the values from the window. For all the other characteristics, the window will be automatically linked to the template.
  6. Validate.
Remark: By default, the size characteristics as well as the window title are automatically overloaded.

Remarks

  • Several templates can be applied to a window. In this case, the controls found in the different templates are included in the window as well as the processes of these templates. The properties of the window (dimension, border, ...) can be linked to a single template only.
  • Some skin template use the "layout" controls (the ActiveVista skin template for example). These controls are used to display the title of the window, the system buttons, ... These layout controls are considered as being properties of the window.
  • In this version:
    • the menus of the template are not applied to the window that is using the template.
    • Android the action bar of the template is not applied to the window that is using the template.
  • The status bars cannot be overloaded.
  • Templates support style overrides.
  • You also have the ability to apply a window template to an existing internal window. For more details, see Internal Window control.
Opening the template associated with a window
To open the template associated with a window:
  1. Display the window in the window editor.
  2. In the context menu of a template element, select "Open template".
Other possibility:
  • List the templates associated with the window: on the "Window" tab, in the "Templates" group, expand "Templates" and select "List of templates used".
  • Select the desired template and click "Open template".
Applying the modifications performed on a template
When a window template is modified, the modifications can be applied to one ore more windows that use this template in the current project.
Applying these modifications is proposed when closing the template.
It can also be performed at any time:
  • from the template: on the "Window" tab, in the "Templates" group, expand "Templates" and select "Update associated windows".
  • from any window that uses the template:
    • by opening the list of templates used: on the "Window" tab, in the "Templates" group, expand "Templates" and select "List of templates used".
    • then by clicking the "Update" button.
  • from the window template, by clicking the icon in the orange banner of the template.
Remark: The modifications made to the template are applied according to the overloaded characteristics of the windows that use the template.
Testing a window template
To run the test of a window template:
  1. Open the template to be tested:
    • On the "Window" tab, in the "Templates" group, expand "Templates" and select "List of templates used",
    • Click "Open template".
  2. Click in the quick access buttons.
List of templates used
To view the list of templates used in a window, go to the "Window" tab, "Templates" group, expand "Templates" and select "List of templates used".
From this window, you can:
  • "Open a template": opens the selected template in the window editor.
  • "Update": the controls and the code of the template are updated the window.
  • "Add": adds a template to the current window.
  • "Dissociate": the template controls found in the window are dissociated from the template. The template is deleted from the list of templates used but its controls are not deleted from the window.
  • "Delete": deletes the template (controls and code) from the window.
Synchronizing the windows and the window templates
You have the ability to synchronize the windows and their templates:
  • when creating executables, components, ... Simply check "Synchronize templates during generation" ("Options" tab in the project description).
  • when running the GO of the project. The window update is automatically proposed according to the window templates.
Example
WINDEVWindows The "Sales Management" example provided with WINDEV uses:
  • the mechanism of templates of templates,
  • window templates,
  • control templates,
  • reverse modeling of templates.
Minimum version required
  • Version 11
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/18/2023

Send a report | Local help