PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • The assertions
  • Implementation
  • Tip
  • Customizing the window of assertions
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
Overview
WINDEV, WEBDEV and WINDEV Mobile include several tools and features used to optimize the applications and the sites.
The main available features are as follows:
The assertions
An assertion is used to check a condition when running the application.
If the condition fails, a dialog box containing the check details is displayed.
The developer can access the runtime stack, which means all calls that resulted in this result.
Implementation
To define an assertion, all you have to do is use dbgAssert with in parameter:
  • the condition to check,
  • the message to display if the condition is not checked.
// CClient variable
clClient is CClient
// Create the client
CreateClient(clClient)
// The clClient object must have been instantiated
dbgAssert(clClient<>Null, "The object was not instantiated")
By default, the assertions are enabled in test mode only.
The assertions can be enabled in deployment: all you have to do is call dbgEnableAssert:
dbgEnableAssert(True)
Caution: The condition used in the assertion is run by WLanguage only when the assertions are enabled. Therefore, the operating mode may differ in test mode and in executable mode.
You must be very careful when using functions in the condition given to dbgAssert. Indeed, if the function used performs an initialization or a connection, this operation will not be performed in the application used in "executable" mode.
On the other hand, this operating mode allows you to run "more tests" without slowing down the deployed application. This gives you the ability to easily enhance the applications.

Tip

The assertions can be used to run "specific" cases or to check the "prerequisites" of a function. This allows you to check the case that should never happen:
  • using an empty string while a logical name is expected,
  • entering a path to a file that does not exist, ...
The assertions cannot replace the standard management of errors. But implementing an assertion allows you to be informed and to find out whether a problem occurred via the execution stack.
The assertions are also used to guide you when the development is performed by several developers: the "calling" code must provoke no assertion in the code that is "called".
WINDEVWindows Mobile

Customizing the window of assertions

By default, the windows for managing the errors, the exceptions and the assertions are included in the application. These windows are available in English and in French.
To customize these windows (or to translate them), all you have to do is import the corresponding windows into your project.
  1. Select the option:
    • WINDEV "File .. Import .. WINDEV elements and their dependencies".
    • WINDEV Mobile "File .. Import .. WINDEV Mobile elements and their dependencies".
    In the ribbon:
    • WINDEV On the "Project" pane, in the "Project" group, expand "Import" and select "WINDEV elements and their dependencies".
    • WINDEV Mobile On the "Project" pane, in the "Project" group, expand "Import" and select "WINDEV Mobile elements and their dependencies".
  2. Select the directory of the elements to import: "Programs\Data\Preset windows\Assertion - Error - Exception".
  3. Select the windows to import:
    WINDEVWINDEV MobileType of window
    WD_DisplayAssert.wdwWM_DisplayAssert.WPWWindow for managing the assertions
    WD_DisplayError.wdwWM_DisplayError.WPWWindow for managing the errors
    WD_DisplayException.wdwWM_DisplayException.WPWWindows for managing the exceptions
    WD_ErrorTemplate.wdtTemplate used by the WINDEV windows.
  4. Validate. The windows are included in your project. These windows will be automatically used and they will replace the default windows.
Note: To use the default windows, all you have to do is delete the imported windows from your project.
Minimum required version
  • Version 11
This page is also available for…
Comments
Click [Add] to post a comment