PC SOFT

WINDEV的在线文档

  • 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
  • Notes
  • Opening the template associated with a window
  • Applying the modifications performed on a template
  • Running the test of a window template
  • List of templates used
  • Synchronizing the windows and the window templates
  • Example
文档页面当前正在翻译。对于此延迟我们深表歉意。
您可以自愿地帮助我们翻译您想要的文档段落,然后只需通过以下地址与我们联系:info@cn.windev.com
产品
WinDevWebDev-服务器代码WebDev-浏览器代码WinDev Mobile报表和查询
平台
WindowsLinuxWindows MobileWindows PhoneWindows Store appsAndroidAndroid Widget iPhone/iPad
语言
JavaPHPAjax用户代码(MCU)外部语言
数据库
HFSQLHFSQL Client/Server存储过程HF 5.5OLE DBODBC本地访问

Overview
WinDev and WinDev Mobile allow you to create window templates. These templates contain the graphic elements and the code common to all the windows found in your application.

The modifications performed in a window template are automatically applied to all the windows that use this template.

A window template allows you to comply with the style book defined for an application.

Using window templates in your applications allows you to:

  • simplify the creation of the application windows.
  • simplify the layout of the application windows.
  • simplify the update of the style book defined for the application.

16版本和更高版本
WinDevLinux The window templates are now available for the WinDev applications in Linux.
16新版本
WinDevLinux The window templates are now available for the WinDev applications in Linux.
WinDevLinux The window templates are now available for the WinDev applications in Linux.

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 ("File .. New .. Window .. Window template").Create a new window template:
    • Clickamong the quick access buttons.
    • In the wheel that is displayed, hover "Window" and click "Window template".The window for creating a new element is displayed: 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,
    • If your project already uses window templates, create a window template based on another window template of the project. In this case, you will have the ability to perform cascading updates of the window templates.
  3. The window editor displays a new window inside a green border named "Window template".
  4. Create all the necessary controls. These controls will be included in all the windows that use the template.
  5. Enter (if necessary):
    • the processes associated with the window.
    • the processes associated with the controls found in the template.
      These processes will be automatically imported into the windows that use the template.
  6. Give a name to your template ("General" tab in the description window).
  7. Select "File .. Save".On the "首页" pane, in the "常规" group, click "保存" (or clickamong the quick access buttons).

The window template corresponds to a file whose extension is ".WDT".

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 the code of the processes required by the template. These processes 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. Select "File .. Save as template". The current window becomes a template:On the "首页" pane, in the "常规" group, expand "保存" and select "Save as template". The current window becomes a template:
    • its name is preceded by "Template".
    • a green border appears around the window in the window editor.
    • the window template is displayed in the "Project" pane ("Templates of windows").
The window template corresponds to a file whose extension is ".WDT".

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 ("File.. New.. Window").Create a new window:
    • Clickamong the quick access buttons.
    • Click "Window" in the wheel that is displayed.The window for creating a new element is displayed: 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 is used to identify the elements belonging 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, by the mechanism for "control overload": 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. Select "Insert .. A template (Inheritance)".On the "窗口" pane, in the "模型" group, expand "模型" 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 overload is displayed. In this window, you have the ability to select the properties of the initial window to keep. The window template will be automatically overloaded for the properties kept. For all the other characteristics, the window will be automatically linked to the template.
  6. Validate.
Note: By default, the size characteristics as well as the window title are automatically overloaded.

Notes

  • 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 uses the template.
  • The status bars cannot be overloaded.
  • No style overload is supported by the templates.
    17版本和更高版本
    The style overload is supported by the templates.
    17新版本
    The style overload is supported by the templates.
    The style overload is supported by the templates.
  • 20版本和更高版本
    You also have the ability to apply a window template to an existing internal window. See Internal Window control for more details.
    20新版本
    You also have the ability to apply a window template to an existing internal window. See Internal Window control for more details.
    You also have the ability to apply a window template to an existing internal window. See Internal Window control for more details.

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 popup menu of a template element, select "Open the template".
Other possibility:
  • List the templates associated with the window ("Windows .. List of templates used").List the templates associated with the window: on the "窗口" pane, in the "模型" group, expand "模型" and select "List of templates used".
  • Select the requested template and click the "Open the template" button.

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 the modifications is proposed when the template is saved.Applying these modifications is proposed when closing the template.


It can also be performed at any time:

  • from the template, via "Windows .. Update the associated windows".from the template: on the "窗口" pane, in the "模型" group, expand "模型" and select "Update the associated windows".
  • from any window that uses the template, by opening the list of templates used ("Windows .. List of templates used") and by clicking the "Update" button.from any window that uses the template:
    • by opening the list of templates used: on the "窗口" pane, in the "模型" group, expand "模型" and select "List of templates used".
    • then by clicking the "Update" button.
  • 17版本和更高版本
    from the window template directly, by clickingin the green bar of the template.
    17新版本
    from the window template directly, by clickingin the green bar of the template.
    from the window template directly, by clickingin the green bar of the template.
Note: The modifications made to the template are applied according to the overloaded characteristics of the windows that use the template.

Running the test of a window template
To run the test of a window template:
  1. Open the template whose test must be run ("Window .. List of templates used", "Open the template" button).Open the template whose test must be run:
    • On the "窗口" pane, in the "模型" group, expand "模型" and select "List of templates used",
    • Click the "Open the template" button.
  2. Click the "Go" button ("Run the window test" icon) or select "Code .. Run the window test".Clickamong the quick access buttons.

List of templates used
To display the list of templates used for a window, select "Windows .. List of templates used".To display the list of templates used for a window, on the "窗口" pane, in the "模型" group, expand "模型" 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.
  • "Unlink": 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, ... To do so, check "Synchronize the windows and the reports according to their templates when generating executables, libraries, components, ..." ("Options" tab of the project description).
  • 17版本和更高版本
    when running the GO of the project. The window update is automatically proposed according to the window templates.
    17新版本
    when running the GO of the project. The window update is automatically proposed according to the window templates.
    when running the GO of the project. The window update is automatically proposed according to the window templates.

Example
WinDevWindows The "Sales Management" example supplied with WinDev is using:
  • the mechanism of templates of templates,
  • the templates of windows,
  • the templates of controls,
  • the reverse modeling of templates.