|
|
|
|
|
- Overview
- Creating a control template
- Creating a control template from the window editor
- Creating a control template from the page editor
- Creating a control template from the report editor
- Creating a control template from existing controls
- Special cases
- Testing a control template in a page or window
- Using a control template
- Renaming a control template
A control template is a set of controls that can be re-used in several windows or pages. - WINDEV and WINDEV Mobile allow you to create control templates that can be used in the windows.
- WEBDEV allows you to create control templates that can be used in pages.
Any changes made to a control template can be applied in all windows, pages or reports that use this template. Control templates allow you to: - group a set of controls for a specific purpose.
- make controls independent from their parent window, page or report.
Additionally, control templates are stored as ".WDT" files, which can be easily shared between projects. Advantage over supercontrols: Any changes made to a given control template can be automatically applied to all windows (or pages) that use that template. Advantage over internal windows, pages or reports: Control templates are directly integrated, visible and editable in the window, page or report. They can be overridden directly in the window, page or report that uses the control template. Creating a control template New in SaaSCreating a control template from the report editor To create a control template from the report editor: - From the report editor, create a new control template:
- Click
in the quick access buttons. - In the window that appears, click "Report" and then "Control template".
- A blank control template is created in the editor.
- Create all the necessary controls. These controls will be in all the reports that use the control template.
Note: Control templates can be nested. A control template can use another control template. - If necessary:
- Write the WLanguage code of the different controls. This code will be automatically imported into the report that uses the control template.
- Anchor the controls in the template. These anchors will be automatically used in the report that uses the control template.
- Adjust the size of the template to the controls present in the template ("Resize" in the context menu).
- Give your template a name ("General" tab of the description window).
Note: If you use the code style, the name of the control template will be prefixed with "TPLC_". - Save your control template (
). The control template is available and it can be used in a "Control template" control. The created file is in ".WDT" format.
Creating a control template from existing controls To create a control template from existing controls: - Select the controls that must be included in the control template.
- On the "Modification" tab, in the "Transformations" group, expand "Refactoring and swapping" and select "Create a control template from the selection".
Remarks: - You can also select "Refactoring .. Create a control template from the selection" in the context menu of the selection.
- You have the ability to create a template of a control template, which means a control template based on another control template.
Special cases - The context menus are available in the control templates:
- If the window includes context menus, the context menus of the control template must have different names.
- The context menus of the control template are added to the context menus of the window.
- If there are two identical control templates with context menus in a window, the override of the context menu of the control template applies to both control templates.
- If several control templates found in a window have the same source, updating a control template triggers the update of all the control templates that use the same source in the window.
Testing a control template in a page or window To test a control template: - Open the control template in the editor.
- Click the "Go" button ("Test window" or "Test page" icon).
To use a control template: - Open the window or the page in which the control template must be included.
- Create a Control Template control:
- in a page or window, go to the "Creation" tab, "Containers" group and click "Control template".
- Select the control template you want to insert into the window, page or report.
Note: The control template is permanently associated with the "Control Template" control. To change the association, you must delete the "Control Template" control and recreate it. - Position the control if necessary, and confirm.
Remarks: - A control template created in WINDEV or WINDEV Mobile (in a window) cannot be used in a page or report.
- A control template created in WEBDEV (in a page) cannot be used in a window or report.
Renaming a control template If a control template is renamed, the link with the elements that use this template is lost. You can re-establish this link in a window that contains the list of templates. To open this window, go to the "Window" tab, "Templates" group, expand "Templates" and select "List of templates used".
Related Examples:
|
Training (WEBDEV): WW_Auto_Zoom
[ + ] This example offers a control template based on an image that displays an image thumbnail and through a click, enlarges the image without disturbing the page's layout. Limitatiosn: - The images cannot be loaded from a database - The control template cannot be included in a looper
|
|
Training (WEBDEV): WW_RSS_Stream
[ + ] This example explains how to read and display a RSS stream in a WEBDEV page via the RSS type and via the WLanguage functions for handling RSS. A reusable control template is used to display the RSS data.
|
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|