PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • How to proceed?
  • Displaying information
  • Managing the display of debug information
  • Creating a trace file
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
In some cases, running a program or a site with or without the debugger can produce different results.
Indeed, the debugger introduces pauses in the execution of the process during which several tasks are performed by WINDEV.
Therefore, the debugger cannot be used in a procedure called by timer or in the code of a scrollbar.
To debug these applications, you may want to follow the evolution of a value, how different procedures are called, ...
WEBDEV - Browser code This method also allows you to debug the browser code (entered in WLanguage).
This information can be:
  • displayed on the screen,
  • stored in a trace file.
Caution: If the information is displayed on the screen, it must be displayed during the application tests only.
How to proceed?

Displaying information

Two tools can be used to display information:
  • The information boxes: Info. Caution: Displaying an information box is a locking operation.
  • The trace window: Trace
The trace window is displayed in the top left corner of screen, without interrupting the program execution. If can also be displayed it in the interface via the "Trace of debugger" pane.
WEBDEV - Browser code The trace window displayed from a browser code differs from the trace window displayed from a server code. Two trace windows can be displayed at the same time. The information found in the "Browser" trace window is not displayed in the "Debugger trace" pane.

Managing the display of debug information

Displaying the debug information on the screen is useful in test mode only.
Any unsuitable display must be removed before distributing an application.
To avoid any oversight, we advise you to manage the display of debug information via a global procedure. For example:
PROCEDURE MyTrace(StringToTrace)
IF InTestMode() = True THEN
        Trace(StringToTrace)
END
In this code, depending on the result of InTestMode, the trace window appears when running the application test or the site test.
Such procedure allows you to leave the call to the trace windows in the application code without any risk of displaying it on the end-user computers.
The call to this trace procedure is identical to the use of Trace:
MyTrace("Customer: " + Customer.CustomerNum)

Creating a trace file

During long processes (batch processes, ...), to check how the program is running, you must keep a physical trace of the processes performed (a text file for example).
The following procedure is used to manage the display of the trace:
  • On the screen (/DEBUG parameter in command line).
  • In a text file (default mode).
PROCEDURE MyTrace(StringToTrace)
FilePath is string
FilePath = fDataDirUser() + ProjectInfo(piProjectName) + ".txt"
FileNum is int
DebugMode is boolean = False
IF Position(CommandLine(), "/DEBUG") > 0 THEN
DebugMode = True
END
IF DebugMode = True THEN
Trace(StringToTrace)
ELSE
FileNum = fOpen(FilePath, foCreateIfNotExist + foWrite + foAdd)
IF FileNum <> -1 THEN
DateTimeTrace is DateTime = SysDateTime()
DateTrace is string = MyDate..Date
TimeTrace is Time = MyDate..Time
fWriteLine(FileNum, DateToString(DateTrace) + ...
" - " + TimeToString(TimeTrace))
fWriteLine(FileNum, StringToTrace)
fWriteLine(FileNum, " ")
fClose(FileNum)
END
END
Notes:
  • The trace file is created by default in the data directory of user. This file is named like the project. This file contains the information to trace during the program execution. The information is completed by the date and time of each "Trace". This allows you to detect a potential problem during the process.
  • Example of content of trace file:
    01/12/2001 - 10:53:25:20
    Customer name: Martin
    01/12/2001 - 10:53:25:26
    Customer name: Mirva
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment