ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or website / Controls, windows and pages / Control template
  • Overview
  • Principle of inheritance and override
  • Overriding the controls in the control template
  • Overriding control properties
  • Overriding the code of controls
  • 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:
  • 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
Overview

Principle of inheritance and override

When a control template is applied to a page or to a window, all the controls and code found in the template are "copied" into the page or window. This is the concept of inheritance.
The template controls are visible in the window in the window editor and 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 code of the template is visible in the code editor, in the different events of the window or page 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 based on another template, the inheritance is performed on several levels.
You can override the controls and the code of the template. Overriding the controls and the code allows you to modify the code and/or the controls in the template.
Overriding the controls in the control template

Overriding control properties

Overriding properties of template controls consists in modifying the characteristics of the controls in the window or page that is using the template (the characteristics displayed in the description window for example).
As soon as one of the characteristics of the template control is modified, this property is overridden.

Overriding the code of controls

To override the code of template controls:
  1. Open the events of the page or window (select "Code" in the context menu).
  2. If an event exists in a template control, this event appears twice in the window or 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 widow or page controls.
  3. The code typed in the event of the page or window control will be run as follows:
    • the event of the template control.
    • the event of the control overridden in the window or page.
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 or the window: right-click the control.
  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: right-click the control.
  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.
  • When a control template is based on another control template, the inheritance can be managed on several levels.
Managing overridden properties of a control

Finding out the overridden properties:

To find out the control properties that have been overridden:
  1. Open the popup 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".
Limitations
  • No embedded query can be used in a template control. The execution of the page or the window that use the template will trigger an error.
  • The styles cannot be overridden.
  • Parents are not supported when a control is overridden (the control does not support the parent). For example, an overridden control is positioned on a tab pane. If the override is canceled, the control is not positioned in the initial tab again
Minimum version required
  • Version 11
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help