|
|
|
|
|
- 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 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: - Create a new window template:
- Click in the quick access buttons.
- The window for creating a new element appears: click on "Window", then on "Window template".
- 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.
- The window editor displays a new window within an orange frame with the "Window template" title.
- Create all the necessary controls. These controls will be included in all the windows that use the template.
- 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.
- Give your template a name ("General" tab of the description window).
- 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: - Open the window chosen as template.
- Keep the controls required by the template. These controls will be included in all the windows that use the window template.
- Keep only the code of the events required by the template. These events will be automatically imported into the windows that use the template.
- Give a name to your window ("General" tab in the description window of the window).
- 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: - Create a new window:
- Click in the quick access buttons.
- When the new element window appears, click "Window" then "Window".
- In the wizard, select the "Based on a template" pane.
- Choose your template from the list of available templates.
- 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 apply to all the windows using this template.
- in the window, with 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: - Display the window in the window editor.
- On the "Window" tab, in the "Templates" group, expand "Templates" and select "Inherit from a template".
- Select the window template to apply.
- Validate.
- 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. - Validate.
Remark: By default, window size and title are automatically overridden. 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, and so on. These style controls are considered as being properties of the window.
- In this version:
- the menus of the template are not applied to the window that uses the template.
- the action bar of the template is not applied to the window that uses 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: - Display the window in the window editor.
- In the context menu of a template element, select "Open template".
Other possibility: - List the templates associated with the window: under the "Window" pane, in the "Templates" group, pull down "Templates" and select "List used templates".
- 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: under the "Window" pane, in the "Templates" group, pull down "Templates" and select "Update associated windows".
- from any window that uses the template:
- by opening the list of models used: in the "Window" pane, in the "Templates" group, scroll down to "Templates" and select "List of models used"..
- then by clicking the "Update" button.
- from the window template, by clicking the icon in the orange banner of the template.
Remark: Modifications to the template are carried over according to the features overridden in windows using the template. Testing a window template To run the test of a window template: - 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".
- Click in the quick access buttons.
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 template": opens the selected template in the window editor.
- "Update": fields and template code are updated in the window.
- "Add": adds a template to the current window.
- "Dissociate": the template fields 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": removes the template (fields 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, etc. Simply check the "Synchronize templates during generation" option ("Options" tab in the project description).
- when running the GO of the project. The window update is automatically proposed according to the window templates.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|