DEV Community

Peter + AI
Peter + AI

Posted on

🎨 Understanding Uniface's fieldvideo Statement: A Legacy Feature Worth Knowing

Hey fellow developers! πŸ‘‹ While working with Uniface 10.4, I came across the fieldvideo statement - a deprecated but still interesting feature for dynamically setting field video attributes. With some assistance from AI, I've put together this comprehensive guide based on the official Uniface Documentation 10.4.

🚨 What is fieldvideo?

The fieldvideo statement is a Uniface function that dynamically sets video attributes for form fields. Think of it as a way to add visual emphasis to your fields - like highlighting, blinking, borders, or color coding.

⚠️ Deprecation Notice

Important to note: fieldvideo is deprecated! It has been superseded by the $fieldvideo function, which works across all component types. However, understanding legacy code is still valuable for maintenance projects.

πŸ”§ Syntax & Parameters

fieldvideo Field, AttributeList
Enter fullscreen mode Exit fullscreen mode

Parameters:

  • Field (String): The field name where video properties are set. If omitted, current field is used.
  • AttributeList (String): Video attributes to apply. Defaults to "DEF" if omitted.

🎯 Available Video Attributes

Code Description
BLI Blinking ✨
BOR Border πŸ”²
BRI Bright πŸ’‘
HLT System highlight color 🎨
INV Inverse πŸ”„
UND Underline ___
COL=n Set color to code n 🌈

πŸ’‘ Practical Example

Here's a real-world example that highlights invalid names with bright, underlined, blinking text:

; field : NAMEDUMMY.E1
trigger Detail
if (F2.E1 != NAMEDUMMY)
 $curOcc$ = $curocc
 $name$ = NAMEDUMMY
 $counter$ = 1
 repeat
 setocc "E1",$counter$
 $counter$ = ($counter$ + 1)
 until ((F2.E1 = $name$) | ($status < 0))
 if ($status < 0)
 message "%%$name$ not available."
 setocc "E1",$curOcc$
 fieldvideo NAMEDUMMY, "BRI,UND,BLI"
 $prompt = NAMEDUMMY.E1
 return (0)
 endif
endif
$prompt = F2.E2
end ; Detail
Enter fullscreen mode Exit fullscreen mode

πŸš€ Key Takeaways

  • Use fieldvideo for dynamic field highlighting in legacy Uniface applications
  • Place calls after read statements in read triggers for best results
  • Remember that ^CLEAR and ^RETRIEVE reset video attributes
  • Migration tip: Consider upgrading to $fieldvideo function for new development

Understanding deprecated features like fieldvideo helps maintain existing codebases while planning for future upgrades. Happy coding! πŸš€

Top comments (0)