ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or website / Test
  • Overview
  • How to?
  • Displaying information
  • Managing the display of debug information
  • Creating a trace file
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Overview
In some cases, running a program or a site with or without the debugger can produce different results.
The debugger sets pauses in the execution of the processes, during which Windows performs multiple tasks.
This means that the debugger cannot be used in a procedure called by a timer or in the code of a scrollbar.
To debug these applications, you may want to follow the changes of a value, how different procedures are called, ...
WEBDEV - Browser code This method also enables you to debug some browser code (entered in WLanguage).
This information can be:
  • displayed on the screen,
  • stored in a trace file.
Note: This information must be displayed during the application tests only.
How to?

Displaying information

Two tools can be used to display information:
  • Dialog boxes: Info WLanguage function. Note: Dialog boxes are modal windows.
  • Trace windows: Trace WLanguage function.
The trace window appears in the upper-left corner of the screen, without interrupting the program. If can also be displayed it in the interface via the "Debugger trace" pane.
WEBDEV - Browser code The trace window displayed from a Browser code is different from the one 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 displaying unnecessary elements, it is recommended to set how the debug information is displayed via a global procedure. For example:
PROCÉDURE MyTrace(StringToTrace)
IF InTestMode() = True THEN
Trace(StringToTrace)
END
In this code, depending on the result of InTestMode, the trace window appears when testing the application or site
This procedure prevents trace windows from being displayed on end-user computers, even if they are called in the code of the application.
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 the operating mode of the program, you must keep a physical trace of the processes run (a text file for example).
The following procedure allows you to define how the trace will be displayed:
  • 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, foCreateIfNotFound + 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
Remarks:
  • The trace file is created by default in the user data directory. The name of this file is the same as the project name. 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 a trace file content:
    01/12/2001 - 10:53:25:20
    Customer name: Martin
    01/12/2001 - 10:53:25:26
    Customer name: Mirva
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 01/07/2025

Send a report | Local help