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)