PC SOFT

WINDEV的在线文档

  • Overview
  • Creating a control template
  • Creating a control template from the window editor
  • Creating a control template from existing controls
  • Special cases
  • Running the test of a control template
  • Using a control template
  • Renaming a control template
文档页面当前正在翻译。对于此延迟我们深表歉意。
您可以自愿地帮助我们翻译您想要的文档段落,然后只需通过以下地址与我们联系: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
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 the pages.
A control template can be edited or modified; when a template is modified, these modifications can be applied to all the windows or pages that use this template.

The control templates are used to:

  • group a set of controls for a specific purpose.
  • make the controls independent of the window that hosts them.
Furthermore, the control templates are saved in a ".WDT" file that can be easily transferred from one project to another.

Benefit compared to supercontrols: The modifications made to the control templates can be automatically applied to all the windows (or pages) that use the control template.

Benefits compared to internal windows or pages: The control templates are directly inserted, visible and modifiable in the window or in the page. They can be directly overloaded in the window or page that is using the control template.

18版本和更高版本
WinDevWindows Store apps The control templates are now available for the applications in Windows Store apps mode.
18新版本
WinDevWindows Store apps The control templates are now available for the applications in Windows Store apps mode.
WinDevWindows Store apps The control templates are now available for the applications in Windows Store apps mode.

Creating a control template
WinDev

Creating a control template from the window editor

To create a control template from the window editor:
  1. 1. From the window editor, create a new control template ("File .. New .. Window .. Control template"). You can:
    • Create a blank template (based or not on the skin template used by the project),
    • Create a blank template based on a skin template other than the one used by the project,
    • If your project is already using the control templates, create a control template based on another control template of the project. In this case, you will have the ability to perform cascading updates of control templates.
    From the window editor, create a new control template:
    • Clickamong the quick access buttons.
    • In the wheel that is displayed, hover "Window" and click "Control template". You can:The window for creating a new element is displayed: click "Window" then "Control template". You can:
      • Create a blank template (based or not on the skin template used by the project),
      • Create a blank template based on a skin template other than the one used by the project,
      • If your project is already using the control templates, create a control template based on another control template of the project. In this case, you will have the ability to perform cascading updates of control templates.
  2. The window editor displays a new area inside a green border named "Control template".
  3. Create all the necessary controls. These controls will be included in all the windows or pages that use the control template.
    Note: The control templates can be nested. A control template can use another control template.
  4. If necessary:
    • Enter the processes associated with the controls. These processes will be automatically imported into the window or into the page that uses the control template.
    • Anchor the controls in the template. These anchors will be automatically used in the window or in the page that uses the control template.
    • Resize the control template according to the controls found in the template ("Resize" from the popup menu).
  5. Give a name to your template ("General" tab in the description window).
    Note: If you are using the programming charter, the name of the control template is prefixed by "TPLC_".
  6. 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.

Limit: No style overload is supported by the templates.

Creating a control template from existing controls

To create a control template from existing controls:
  1. Select the controls that must be included in the control template.
  2. Select "Control .. Refactoring .. Create a control template from the selection".On the "修改" pane, in the "转换" group, expand "重构和切换" and select "Create a control template from the selection".
Notes:
  • You can also select "Refactoring .. Create a control template from the selection" from the popup menu of the selection.
  • You have the ability to create a template of a control template, which means a a control template based on another control template.

Special cases

  • The popup menus are available in the control templates:
    • If the window includes popup menus, the popup menus of the control template must have different names.
    • The popup menus of the control template are added to the popup menus of the window.
    • If two identical control templates with popup menus are found in a window, the overload of the popup menu of the control template is valid for 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.

Running the test of a control template
To run the test of a control template:
  1. Open the control template in the editor.
  2. Click the "Go" button ("Run the window test" or "Run the page test" icon).

Using a control template
To use a control template:
  1. Open the window or the page in which the control template must be included.
  2. Create a Control Template control (select "Insert .. Special .. Control Template control" or click).Create a Control Template control: on the "创建" pane, in the "容器" group, click "控件模型".
  3. Select the control template that will be included in the window or in the page.
    Caution: The control template is associated once and for all to the "Control Template" control. To change the association, you must delete the "Control Template" control and re-create it.
  4. Validate and position the control in the window or in the page.
Note: A control template created by WinDev (for a window) cannot be used in a page and a control template created by WebDev (for a page) cannot be used in a window.

Renaming a control template

If a control template is renamed, the link with the elements that use this template is lost.

This link can be restored via the window that lists the templates ("Windows .. List of templates used").This link can be restored via the window that lists the templates: on the "窗口" pane, in the "模型" group, expand "模型" and select "List of templates used".