ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Editors / Code editor
  • Overview
  • Principle
  • The different platforms and targets
  • Operating mode
  • How to?
  • How to implement the conditional target-code?
  • Features of the conditional target-code
  • Displaying a target-code
  • Target-code description
  • Limits
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Warning
From version 25, this feature is not available anymore. It has been replaced with the "<COMPILE IF>" and "IF ExecutionTarget" statements.
Overview
The code editor allows you to enter a specific code for each environment (WINDEV, WEBDEV and WINDEV Mobile).
Furthermore, depending on the platform (Windows or Linux) and on the type of generation (Java, PHP, .NET application or Webservice), you can choose different targets for each environment. The term of "platform" is used to distinguish between these types of code.
For example, a print process will not be performed the same way in Windows, in Internet or on a mobile device with an infrared connection.
Remark: Depending on the case, a conditional target-code can be replaced with the <COMPILE IF> statement.
Principle

The different platforms and targets

The following platforms are available:
  • 32-bit Windows application
  • 64-bit Windows application
  • Java application
  • .Net application
  • 32-bit Linux application
  • WINDEV Mobile
  • WEBDEV Windows
  • WEBDEV Linux
  • WEBDEV PHP
  • Webservice
  • 32-bit Windows service
  • 64-bit Windows service
  • 32-bit Linux daemon
  • 64-bit Linux daemon
  • Android application
  • 64-bit Linux application
  • Universal Windows Platform application
Only some platforms can be accessed depending on the event on which you are positioned. For example, no PHP code can be entered in the code of a button found in a WINDEV window.
The platforms are accessible in the following codes:
  • code of the project.
  • code of classes.
  • code of sets of procedures.
  • code of reports (including the code of controls).
The table below summarizes the platforms accessible according to the current code:
PlatformCode of WINDEV window Code of WINDEV Mobile windowCode of WEBDEV page
32-bit Windows application
x
64-bit Windows application
x
Java application
x
.Net application
x
WINDEV Mobile
x
WEBDEV Windows
x
WEBDEV Linux
x
WEBDEV PHP
x
Remark: The "Webservice" platform can only be used in the code of classes and in the code of sets of procedures.

Operating mode

You can have up to 8 different targets in the same code: your code will be divided into 8 "parallel" sections (vertical division in the code). The code that will be run in the application will depend on the environment, the type of generation and the operating system.
In some cases, the code to run may be identical for several platforms. You have the ability to group several platforms.
Example: when creating a multi-platform "Login" component, the initialization code will differ depending on whether the component is included in a WINDEV project, in a WINDEV Mobile project or in a WEBDEV project.
  • In this case, the code is identical for "Windows application" and for "Java application". This code is entered in the same "target" that groups these two platforms.
  • The code for WINDEV Mobile uses the same function as the first target but it is calling a different window (WINDEV Mobile window).
  • The third target affects "WEBDEV Windows", "WEBDEV Linux" and "WEBDEV PHP". The code is identical for these three platforms.
How to?

How to implement the conditional target-code?

To implement a conditional target-code:
  1. Go to the code where you want to insert a target-code.
  2. On the "Code" pane, in the "Target code" group, expand "Target code" and select "New area".
  3. The following window appears:
  4. Check the products affected by the current code: a target will be created for each environment checked. If you are positioned in the initialization code of the project, you will have:
    • for WINDEV: 1 target with "32-bit WINDEV", "64-bit WINDEV", "Java application", "32-bit Linux application", ".Net application", "Webservice", "32-bit Windows service", "64-bit Windows service", "32-bit Daemon", "64-bit Linux Daemon".
    • for WINDEV Mobile: 1 target with "WINDEV Mobile", "Android application".
    • for WEBDEV: 1 target with "WEBDEV Windows", "WEBDEV Linux" and "WEBDEV PHP".
The "Advanced" button is used to customize the targets by choosing the available platforms:
Reminder: The list of available platforms depends on the current code.
This window allows you to see the different targets and to add or delete targets with the "+" and "-" buttons.
  • To add a platform to a target:
    • select the platforms (multi-selection list) that must be included in the target.
    • select the column corresponding to the target into which the platforms must be added.
    • click the add button .
  • To delete a platform from a target:
    • click the relevant platform.
    • click the delete button .
Features of the conditional target-code

Displaying a target-code

When you are working on one of the targets, you have the ability to display this target on the entire width of the code editor. The other targets are automatically hidden in order to provide an optimal display.
To perform this operation, click the button corresponding to the platform to display (top right of the target-code).
In our example, the code displayed affects the target that groups "WEBDEV Windows", "WEBDEV Linux" and "WEBDEV PHP". Two buttons are available in the target to display the code of targets 1 ("Windows Application" and "Java Application") and 2 (WINDEV Mobile).
For each target, an icon and a caption (displayed in the top left corner) allow you to easily identify the platforms associated with the target.

Target-code description

Each target in the target-code has a icon in the upper-left corner. This button is used to edit the description of the target-code. This allows you to modify the description of the target-code at any time: add a target, modify the platforms of a target, ...
A click performed on this button opens a popup menu:
This popup menu is used to add a code section, to delete a target area, ...
Limits
  • The declaration of global variables cannot be performed in a conditional target-code.
  • Local variables must have unique names for all the code areas.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 10/27/2022

Send a report | Local help