Understanding the Uniface Display Statement: Creating Read-Only Forms 📖
Peter

Peter @petercode

Joined:
Jul 12, 2025

Understanding the Uniface Display Statement: Creating Read-Only Forms 📖

Publish Date: Jul 13
0 0

What is the Display Statement? 🎯

The display statement in Uniface is a powerful tool that presents forms on the screen as display-only, meaning users can view the data but cannot modify it. This is particularly useful for creating read-only interfaces or confirmation screens.

Basic Syntax 📝

display{/menu} {LitFieldName}
Enter fullscreen mode Exit fullscreen mode

Example:

display CLIENT_DETAIL
Enter fullscreen mode Exit fullscreen mode

Key Features and Parameters 🔧

Qualifiers

  • /menu - Activates the menu trigger at field, entity, form, or application level when the form appears

Parameters

  • LitFieldName (Literal) - The name of the field where the cursor should be positioned
    • Don't enclose in quotation marks
    • If omitted, cursor positions on the first painted field (top-left corner)

Return Values 📊

The $status variable returns different values based on user actions:

Value Meaning
10 User used ^QUIT to leave the form
9 User used ^ACCEPT to leave the form
0 Success
-16 Application running in batch mode

Common Error Codes ⚠️

Watch out for these common errors returned by $procerror:

  • -33 - Statement not allowed in batch mode
  • -1401 - Prompted field not valid
  • -1402 - Statement not allowed in this trigger (must be in exec operation)

Practical Example 💡

Here's a real-world example showing how to use the display statement:

operation exec
     CUST_NBR = $1
     retrieve
     message "%%$hits customers match search profile"
     display CUSTNAME
end; exec
Enter fullscreen mode Exit fullscreen mode

This code:

  1. Sets the customer number from a parameter
  2. Retrieves the customer data
  3. Shows a message with the number of matches
  4. Displays the customer name field in read-only mode

Important Usage Notes 📌

  • ✅ Can only be used in Form components
  • ✅ Must be within an exec operation
  • ✅ Alternative: Use newinstance with DISPLAY=TRUE
  • ✅ Alternative: Use run/display to start forms in display-only mode
  • ⚠️ Test for $batch to avoid batch mode errors

Best Practices 🏆

  • Always handle the return values to provide proper user feedback
  • Use meaningful field names for cursor positioning
  • Consider the user experience when choosing between display modes
  • Test your forms in different scenarios to ensure proper behavior

Conclusion 🎉

The Uniface display statement is an essential tool for creating read-only user interfaces. By understanding its syntax, parameters, and return values, you can build more robust and user-friendly applications.

Have you used the display statement in your Uniface projects? Share your experiences in the comments below! 💬


This article is based on the official Uniface Documentation 10.4 and was created with AI assistance to help developers understand this important feature.

Comments 0 total

    Add comment