DEV Community

Peter + AI
Peter + AI

Posted on

๐ŸŽฏ Mastering the Uniface show Statement: Real-Time Form Updates Made Simple

This article was created with AI assistance to help fellow developers understand this essential Uniface feature better. ๐Ÿค–

๐Ÿ“ What is the show Statement?

The show statement is a powerful Uniface ProcScript command that displays or refreshes form components instantly. Think of it as your window refresher - it updates what users see on screen without waiting for their input! ๐Ÿ”„

Key Feature: Unlike edit and display statements that pause execution waiting for user interaction, show keeps your code running while updating the display.

๐ŸŽฏ Basic Syntax

show
Enter fullscreen mode Exit fullscreen mode

That's it! Simple and clean. โœจ

โš™๏ธ How It Works

When you execute a show statement, Uniface performs these actions:

  • ๐Ÿ”„ Synchronizes Display: Updates all visible field values
  • ๐ŸŽจ Applies Properties: Refreshes current property values (except entity properties for current occurrences)
  • โšก No Triggers Fired: Performs update without triggering events
  • ๐Ÿš€ Continues Execution: Code keeps running without waiting for user input

๐Ÿ—๏ธ Where to Use It

Component Type: Form components only ๐Ÿ“ฑ

Error Alert: Using show in service components returns error -1402 (UPROCERR_STATEMENT). Remember this limitation! โš ๏ธ

๐Ÿ’ป Practical Example: Live Countdown

Here's a real-world example showing show in action for creating a live countdown display:

function CountDown() variables numeric j endvariables MyField.MyEnt = 10 while (MyField.MyEnt > 0) show ; Update display immediately j = 10000 ; Create small delay while (j>0) j = j - 1 endwhile MyField.MyEnt = MyField.MyEnt - 1 ; Decrease counter endwhile end; CountDown
Enter fullscreen mode Exit fullscreen mode

What happens here:

  • ๐ŸŽฏ Sets initial countdown value to 10
  • ๐Ÿ”„ Uses show to immediately display each countdown number
  • โฑ๏ธ Creates a small delay for visual effect
  • ๐Ÿ“‰ Decrements counter and repeats until zero

๐Ÿ”ง Configuration Tips

Display Update Issues? If Uniface doesn't update the display completely, modify the AsynchGui setting in your usys.ini file:

AsynchGui = 2 ; Flush mode for complete screen updates
Enter fullscreen mode Exit fullscreen mode

๐Ÿš€ Common Use Cases

  • ๐Ÿ“Š Progress Indicators: Show real-time progress during long operations
  • ๐Ÿ”„ Live Data Updates: Display changing values during calculations
  • โฑ๏ธ Status Updates: Keep users informed about ongoing processes
  • ๐ŸŽฎ Interactive Elements: Create dynamic user interfaces

โšก Performance Considerations

Important: The show statement forces immediate screen updates. Use it wisely in loops to avoid performance issues! Consider adding small delays between updates for better user experience. ๐ŸŽฏ

๐Ÿ”— Related Statements

Compare show with similar statements:

  • ๐Ÿ“ edit: Displays form AND waits for user input
  • ๐Ÿ‘๏ธ display: Shows read-only form AND waits for user interaction
  • โšก show: Updates display WITHOUT waiting (continues execution)

๐Ÿ’ก Pro Tips

  • ๐ŸŽฏ Perfect for creating responsive user interfaces
  • ๐Ÿ”„ Ideal for showing progress in batch operations
  • โš ๏ธ Remember: Form components only!
  • ๐Ÿš€ Use with $interactive and $editmode for advanced form control

๐ŸŽ‰ Conclusion

The show statement is your go-to tool for creating dynamic, responsive Uniface applications. Its simplicity makes it perfect for real-time updates, progress indicators, and interactive user experiences. Master this statement, and you'll significantly improve your application's user experience! ๐ŸŒŸ

Happy coding with Uniface! ๐Ÿš€

Top comments (0)