ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / Developing an application or website / Controls, windows and pages / Page template
  • Overview
  • Principle of inheritance and override
  • Page overload
  • Overriding the properties of pages
  • Overridden the code of pages
  • Overriding controls
  • Overriding the control style (UI override)
  • Overriding the control code (code override)
  • Remarks
  • Managing overridden properties of a control
  • Finding out the overridden properties
  • Overriding local procedures
  • Overriding the code of a local procedure
  • Limitations
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
Page templates and inheritance
Overview

Principle of inheritance and override

When a page template is applied to a page, all the controls and code found in the template are "copied" into the page. This is the concept of inheritance.
The template controls are visible in the page, in the page editor. A yellow square is found in the upper-left corner of each control. By default, the controls found in the template cannot be modified.
The template code is visible in the code editor, in the different events of the page or its controls. This WLanguage code can be easily identified:
  • the events associated with the template are followed by "(<Template name> template)" (for example: "Click the Validate button (MyTemplate template)").
  • the background of the events is grayed because the code cannot be modified.
For a template of templates, the inheritance is performed on several levels.
You can override the controls and the code of the template. Overriding the controls and the code enables you to modify, for a given page, the code and/or the controls of the template.
Page overload

Overriding the properties of pages

Overriding the properties of template pages consists in modifying the characteristics of the page that uses the template (characteristics displayed in the description window, for example).
As soon as one of the characteristics of the page that uses the template is modified, this property is overridden.
Remark: The following page properties can be overridden: Image, Fixed background image, Background color, Text color, Link color, Color of visited link, Color of active link, Underlined link, Center the page, Anchor the controls in the page, Title, Control for displaying the progress bar, Position of Ajax progress bar. A template menu can also be overridden.

Overridden the code of pages

To override the code of template pages:
  1. Open the events of the page (select "Code" in the context menu).
  2. If an event exists in the template page, this event appears twice in the page that uses the template. Indeed, the following elements are displayed:
    • the event from the template. This event appears in gray and its caption is followed by "(<Template name> template)".
    • the event of the page.
  3. The code entered in the page event will be run as follows:
    • the "Global declarations" event is merged between the template and the page that uses the template. Therefore, variables with the same name must not be used in this event.
    • for all the events (except the page closing event): the events of templates applied to the page are run in the order in which they were included, then the event corresponding to the page is run.
    • for the page closing event: the page closing event is run, then the events of templates applied to the page are run in the reverse order in which they were included.
Overriding controls

Overriding the control style (UI override)

To override the interface of a template control (a button for example):
  1. Open the context menu of a template button found in the page.
  2. Select "Override control".
  3. The yellow square was replaced with a blue square, indicating that this control can be overridden.
  4. You can now modify all the aspects of the button interface: dimensions, position, style, etc.

Overriding the control code (code override)

To override the code of a template control (code of a button for example):
  1. Open the context menu of a template button found in the window.
  2. Select "Override control".
  3. The yellow square was replaced with a blue square, indicating that this control can be overridden.
  4. Display the button code ("Code" in the context menu).
  5. Two sections of click code are found:
    • the click code issued from the template.
    • the click code of the page. A function was automatically added: ExecuteAncestor. This function runs the click code of the template.
  6. Add the code of button specific to the current page before and/or after the procedure for calling the template code. You have the ability to delete ExecuteAncestor if you do not want the template code to be run.

Remarks

  • An overridden button cannot be deleted from a template.
  • Overriding a table also overrides the columns. You have the ability to add columns into an inherited table.
  • The styles cannot be overridden. However, it is possible to override the style of a control.
Managing overridden properties of a control

Finding out the overridden properties

To find out the control properties that have been overridden:
  1. Open the context menu of control.
  2. Select "Overridden properties".
  3. The override management window opens.
This window allows you to delete overridden properties. To do so, select the requested property and delete it.
To entirely delete the override performed on a control, simply select "Full override".
Overriding local procedures

Overriding the code of a local procedure

To override the code of a local procedure from the "Project explorer" pane:
  1. Select the element associated with the local procedure (window, page, report, etc.).
  2. Expand the element options and select "Local procedures".
  3. Select the procedure to override.
  4. Open the context menu and select "Override code of local procedure".
  5. Two sections of click code are found:
    Overriding a local procedure
    • the code of the procedure issued from the template.
    • the code of the new procedure. A function was automatically added: ExecuteAncestor. This function runs the code of the template procedure.
  6. Add the code of the new procedure specific to the current element, before and/or after the procedure for calling the template code. You have the ability to delete ExecuteAncestor if you do not want the template code to be run.
Limitations
  • No embedded query can be used in a template control. The execution of the page that uses the template will trigger an error.
  • Style override is not available.
See also
Minimum version required
  • Version 11
Comments
Click [Add] to post a comment

Last update: 06/17/2023

Send a report | Local help