π What is the debug
Statement?
As a Uniface developer, you're certainly familiar with the challenges of debugging complex applications. The debug
statement is a powerful tool that helps you step through your components and identify issues systematically.
π Basics
Syntax: debug
Return Values: None
Usage: Allowed in all Uniface component types
π§ How Does It Work?
The debug
statement puts your component into debug mode:
π₯οΈ GUI Environment
- Starts the Uniface Debugger
- Enables entering debugging commands
- Provides a complete graphical interface
π» Character Mode
- Shows a debug command line at the bottom of the screen
- Works in text-based environments as well
π― Practical Application
Standard Implementation
;Exec trigger
debug
edit
end ; end trigger
π± Development vs. Production Environment
During development, it's common to place the debug
statement in the Switch Keyboard trigger at the application level:
trigger keyboardSwitch
if ($logical("SwitchKeyboard") = "debug")
debug
endif
end
β οΈ Important Note: The statement should be removed before production or embedded in a conditional instruction!
π’ Server Debugging
π« Limitations
The debug
statement is not implemented for the Uniface Server:
- The Debugger is neither started nor stopped
- Windows server processes cannot start windowing applications that need a desktop to run on
π‘ Solution for Server Debugging
- Start the Debugger before the server (manually or via Uniface Router)
- For remote debugging: Configure a unique TCP port for communication
π§ Enabling Debugging in Deployed Applications
For the rare case when you need to debug in a production application:
Step 1: Add ProcScript
trigger keyboardSwitch
if ($logical("SwitchKeyboard") = "debug")
debug
endif
end
Step 2: Modify Assignment File
[LOGICALS]
SwitchKeyboard=debug
Step 3: Activate Trigger
Press GOLD Y to start the debugger.
π Alternative: The /deb Switch
You can also use the /deb
switch to start the application together with the Debugger. This is particularly useful for systematic debugging from the beginning.
π Conclusion
The debug
statement is an indispensable tool for every Uniface developer. It enables you to:
- β Step through code line by line
- β Inspect variables at runtime
- β Use flexible debugging strategies
- β Debug both locally and remotely
π‘ Tip: Use conditional debug statements during development and remove them before production for optimal performance!
This article was created with AI assistance and is based on the official Uniface 10.4 documentation. Do you have questions or additional tips for Uniface debugging? Feel free to share them in the comments! π
Top comments (0)