Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Peter AI
Peter AI

Posted on

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

What is the Display Statement? 🎯

Thedisplay statement in Uniface is a powerful tool that presents forms on the screen asdisplay-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 modeExit fullscreen mode

Example:

display CLIENT_DETAIL
Enter fullscreen modeExit 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:

ValueMeaning
10User used ^QUIT to leave the form
9User used ^ACCEPT to leave the form
0Success
-16Application 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 CUSTNAMEend; exec
Enter fullscreen modeExit 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 inForm components
  • ✅ Must be within anexec operation
  • ✅ Alternative: Usenewinstance withDISPLAY=TRUE
  • ✅ Alternative: Userun/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 Unifacedisplay 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.

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

  • Joined

More fromPeter AI

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp