PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • Creating a supercontrol in the editor
  • Method 1
  • Method 2
  • Adding a control into a supercontrol
  • Supercontrols and scrollbars
  • Programming a supercontrol
  • Declaring the global variables of the supercontrol
  • Declaring the functions and procedures linked to the supercontrol
  • Accessing the supercontrol and the controls of supercontrol
  • Value of a supercontrol
  • Functions and properties specific to the supercontrols
  • Functions specific to the supercontrols
  • Properties specific to the supercontrols
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Designing a supercontrol
Overview
A supercontrol is an advanced type of control. A supercontrol groups a set of controls for a specific purpose. These controls are independent from the processes of the window or page that hosts them.
Two types of users are allowed to handle a supercontrol:
  • The creator of supercontrol: person who designs the supercontrol as well as its features.
  • The user of supercontrol: person who is including the supercontrol in his window (or page) and who will be using it by programming. For more details, see: Including a supercontrol in a window or in a page.
Versions 16 and later
Android The supercontrols are now available in Android.
New in version 16
Android The supercontrols are now available in Android.
Android The supercontrols are now available in Android.
Versions 18 and later
Universal Windows 10 App The supercontrols are now available for the applications in Windows Store apps mode.
New in version 18
Universal Windows 10 App The supercontrols are now available for the applications in Windows Store apps mode.
Universal Windows 10 App The supercontrols are now available for the applications in Windows Store apps mode.
Versions 21 and later
Universal Windows 10 App The supercontrols are now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App The supercontrols are now available in Universal Windows 10 App mode.
Universal Windows 10 App The supercontrols are now available in Universal Windows 10 App mode.
Creating a supercontrol in the editor
Two methods can be used to create a supercontrol:
  • Creating an empty supercontrol and creating the controls included in the supercontrol.
  • Creating a supercontrol from existing controls.
Note: No custom supercontrol can be added to the supercontrols proposed by WINDEV, WEBDEV and WINDEV Mobile.

Method 1

  1. In the window editor or in the page editor, click .In the window editor or in the page editor, on the "Creation" pane, in the "Containers" group, click "Supercontrol".
  2. Click the position where the control will be created in the window (or in the page). The outline of the supercontrol appears.
  3. Display the description of the control ("Description" from the popup menu).
  4. Add the different controls included in the supercontrol ([Add] button).
Caution: The controls associated with the supercontrol must belong to the supercontrol area defined in the editor. Otherwise, the control will be grayed in the editor and it will not be displayed at run time.

Method 2

  1. In the window editor or page editor, create the different controls that are included in the supercontrol.
  2. Select the controls ([Ctrl] key + mouse click or with the lasso).
  3. Select "Control .. Refactoring .. Create a supercontrol from the selection".On the "Modification" pane, in the "Transformations" group, expand "Refactoring and swapping" and select "Create a supercontrol from the selection".
Note: The controls associated with the supercontrol are anchored in relation to the supercontrol (and not in relation to the window or to the page).

Adding a control into a supercontrol

To add a control into a supercontrol:
  1. Create (if necessary) the control that must be added to the supercontrol.
  2. Position the control in the supercontrol area. The supercontrol area is bordered by a green line.
    The control is automatically added to the supercontrol.

Supercontrols and scrollbars

A supercontrol contains a displayed area (black handles) and a displayable area (red handles).
To modify one of these two areas, move the handles while keeping the SHIFT key down.
If the displayed area is smaller than the displayable area, scrollbars are automatically displayed.
This is used to create supercontrols with scrollbars allowing you to scroll the supercontrol content.
Versions 17 and later
AndroidJava The supercontrols with scrollbars are now available.
New in version 17
AndroidJava The supercontrols with scrollbars are now available.
AndroidJava The supercontrols with scrollbars are now available.
Programming a supercontrol

Declaring the global variables of the supercontrol

The supercontrol includes a declaration code of global variables (see Processes associated with the supercontrol). This code is used to declare all the variables global to the supercontrol. All the types of variables are supported. They can be used in any process associated with the supercontrol or with one of the controls included in the supercontrol.

Declaring the functions and procedures linked to the supercontrol

To create a procedure local to the supercontrol:
  1. Display the supercontrol description.
  2. Click the "Add" button found below the "Local procedures" control. A new procedure is created.
  3. Click the "Code" button to edit the code of procedure.
Tip: To create local procedures linked to the supercontrol, you can perform the following operations:
  1. Select your window (or page) and the supercontrol in the "Project explorer" pane.
  2. Click the black arrow found beside the name of the supercontrol in the project explorer. The local procedures appear.
  3. Select "Local procedures". The local procedures displayed are the ones of the supercontrol. You have the ability to add, rename or delete local procedures in the supercontrol.

Accessing the supercontrol and the controls of supercontrol

When programming the supercontrol, you must access:
  • The supercontrol:
    as the process must be independent of the supercontrol name, to find out the supercontrol name, we recommend that you use the MyParent keyword or functions such as ControlPopupOwner, ControlCurrent, ...
  • The controls of supercontrol:
    To do so, use the control variable in the code. From outside the supercontrol (code of popup menu of supercontrol control for example), you must use the following notation:
    <Supercontrol Name>.<Control Name>
Note: EnumControl is used to list the controls belonging to a supercontrol.
Example
The following example corresponds to the code of an option in a popup menu. This menu is associated with a control of a supercontrol and it is used to modify the "StartDate" and "EndDate" controls of the supercontrol.
In this code, the name of the current supercontrol is returned by ControlPopupOwner. The controls found in the supercontrol are handled by the indirection operators.
// Retrieves the current supercontrol
sSuperControl is string
sSuperControl = ExtractString(PopupField(), 1, ".")
dDate is Date     // Today's date by default
// Goes to the previous day
dDate..Day--
// Displays the date of previous day
{sSuperControl+".StartDate"}..Value = dDate
{sSuperControl+".EndDate"}..Value = dDate

Value of a supercontrol

A supercontrol includes several controls and it can return a value. This value can correspond to the value of a control found in the supercontrol or to any other information. This value is an empty string by default. It can be modified by ..Value or by direct assignment.
Example: A supercontrol is used to select a file. It contains an edit control and a button used to opens the file picker. The value of the supercontrol must correspond to the name of the selected file. To do so, the value of the supercontrol must be assigned:
  • in the modification code of the edit control,
  • in the click code of the selection button.
In this code, the MyParent keyword is used to designate the supercontrol in the code of one of its own controls.
// Modification code of the edit control
MyParent = MySelf
// Code of selection button
FileName = fSelect(fExtractPath(FileName, fDirectory), ...
fExtractPath(FileName, fFileName + fExtension), ...
"Select a file", ...
"All files (*.*)" + TAB + "*.*", "")
MyParent = FileName
Functions and properties specific to the supercontrols

Functions specific to the supercontrols

The following functions are used to manage the characteristics of a supercontrol by programming.
EnumControlReturns the name of the Nth control belonging to the supercontrol.
WinUsefulSizeSpecifies the useful size for the supercontrols with scrollbars.
Android This function is not available.
Universal Windows 10 App This function is not available.
ResetRe-initializes the controls found in a supercontrol.

Properties specific to the supercontrols

The following properties are used to manage the characteristics of a supercontrol by programming.
HeightUsed to find out and modify the height of the supercontrol.
WidthUsed to find out and modify the width of the supercontrol.
NameUsed to find out the name of the supercontrol.
ValueUsed to find out and modify the value of the supercontrol.

To find out the entire list of WLanguage properties that can be used with a supercontrol, see Properties associated with a supercontrol.
See also
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment