ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

New WEBDEV 28 feature!
  • In this lesson you will learn the following concepts
  • Overview
  • Step by step
  • Step 1: Creating an internal component
  • Step 2: Using the internal component
Lesson 9.1. Internal components
In this lesson you will learn the following concepts
  • What is an internal component?
  • Creating an internal component, step by step.
  • Distributing and using an internal component.
Lesson duration

Estimated time: 30 mn
Previous LessonTable of contentsNext Lesson
Overview
An internal component is a set of elements from a project. This set is used to:
  • organize a project,
  • share elements between different projects (mainly via the Source Code Manager).
When an internal component is integrated into a project, all its elements are also integrated. Public elements can be handled directly in the editor. In addition, the internal component can be debugged directly from the project that uses it.
In WEBDEV, projects that use internal components can access the names of the objects, procedures or methods defined as visible by the author of the component.
Creating a component is very simple.
Simply create your pages, procedures and classes. When you're done, choose the option available in the editor to create an internal component.
An internal component can contain code, pages, an analysis, data files, etc.
Step by step

Step 1: Creating an internal component

We will create an internal component to subscribe and unsubscribe from a newsletter.
This component includes:
  • a page to see the newsletter subscribers,
  • a web control template that contains the different controls (email address, validation button, etc.),
  • an analysis with the description of the subscriber data file.
To avoid writing the code of the component, all the necessary elements have been included in a project named "WW_Internal_Component". We will use this project to create our internal component. Then, we will use the internal component in the "Full WEBDEV Site" project.

  • To open the example project:
    1. Start WEBDEV 28.
    2. Go to the WEBDEV home page if necessary (Ctrl + <).
    3. On the home page, click "Tutorial", then in "Part 9 - Lesson 9.1 - Internal components", double-click "Internal component - Exercise".
    4. The project is loaded.

      Answers

      A completed project that contains the internal component is available. To open the completed project, go to the home page and click "Tutorial", then in "Part 9 - Lesson 9.1 - Internal components", double-click "Internal component - Answers".
  • We will test the control template of this project:
    1. Open the "TPLC_NewsletterSubscription" web control template (double-click its name in the "Project explorer" pane).
    2. Test the web control template (click Test an element in the quick access buttons).
    3. Type an email address.
      Control template test
    4. Click "VALIDATE" to add the address to the data file.
    5. Close the browser and go back to the editor.
    6. You can check the content of the data file with WDMap (accessible in the "Tools" tab of the ribbon).
Now we will create our internal component.
  • To create an internal component:
    1. In the "Project explorer" pane:
      • Select "Internal components".
      • Right-click to open the context menu.
        Internal component in the
      • Select "New internal component".
      • The internal component creation wizard starts.
    2. Go to the next step of the wizard.
    3. Name the component: enter "InternalComponentNewsletterSubscription". The component caption is automatically filled in.
    4. Go to the next step.
    5. Select the elements that will be included in the component. In this case, select all the elements.
      Internal component creation wizard
    6. Go to the next step.
    7. Select the component elements that will be accessible from the client project.
      In this case, select all the elements.
      Internal component creation wizard
    8. Go to the next step.
    9. In this step, you can specify the data management mode of the component. In our case, the internal component will use its own analysis.
      Select "Use a specific analysis", then, in the "Analysis" field, select the analysis corresponding to the current project ("WW_Internal_Component.wda" file located in the "WW_Internal_component.ana" subdirectory of the project). For example: "My Projects\My Examples\WW_Internal_Component (Exercises)\WW_Internal_Component.ana".
      Internal component creation wizard
    10. Finish the wizard. WEBDEV creates the internal component in a specific directory of your project.
In the "Project explorer" pane, the "TPLC_NewsletterSubscription" control template no longer appears in the list of web control templates of the project. However, the previously created internal component appears in the list of "Internal components" with its different elements: analysis and web control template.
Internal component in the

Step 2: Using the internal component

Once created, your internal component can be used in any other WEBDEV project. Let's see how to reuse the component.

Note

In this example, we will see how to use the internal component directly. To share resources, it is recommended to use the internal components via the Source Code Manager (SCM).
For more details, see Internal component.
In our example, we will import the internal component into the "Full WEBDEV Site" project.

  • Open the "Full_WEBDEV_Site" project.
    1. Go to the WEBDEV home page (Ctrl + <).
    2. On the home page, click "Tutorial", then in "Part 9 - Lesson 9.1 - Internal components", double-click "Full WEBDEV Site - Exercise".
    3. WEBDEV opens a dialog box to inform you that the project has already been opened and prompts you to open the local version or overwrite the project with the original version. To retrieve your changes, click "Open the local copy".

      Answers

      A completed project is available. You can use this project to complete the different exercises of this lesson. To open the completed project, go to the home page and click "Tutorial", then in "Part 9 - Lesson 9.1 - Internal components", double-click "Full WEBDEV Site - Answers".

  • Import the internal component into the project.
    1. In the ribbon, on the "Project" tab, in the "Project" group, expand "Import" and select "An Internal component .. From a file".
    2. Select the following file: "My Projects\My Examples\WW_Internal_Components (Exercises)\InternalComponentNewsletterSubscription\InternalComponentNewsletterSubscription.wci". This file corresponds to the previously created component.
    3. The internal component is imported into the project.
  • To use the internal component, we will add the web control template of the internal component to the home page of the website. To do so:
    1. Open the "PAGE_List_of_new_products" page in the editor (double-click its name in the "Project explorer" pane).
    2. Move the looper down to insert the control template of the internal component.
    3. In the ribbon, on the "Creation" tab, in the "Containers" group, click "Control template".
    4. The window that shows the control templates of the project appears.
      Selecting the control template
    5. Select the template from the internal component and validate.
    6. Click where you want to add the control template.
      Creating a control template in the page
  • We will test the control template:
    1. Test the page (click Test an element in the quick access buttons).
    2. Type an email address.
    3. Click "VALIDATE".
    4. A message confirms the subscription.
      Test of the control template
Previous LessonTable of contentsNext Lesson
Minimum version required
  • Version 28
Comments
Click [Add] to post a comment