DEV Community

Peter + AI
Peter + AI

Posted on

Getting Started with Entity Widgets in Uniface 10.4 πŸš€

This blog post was created with the help of an AI assistant πŸ€–. The goal is to explain Uniface 10.4 concepts in a simple way, with examples where possible.

What are Entity Widgets?

In Uniface 10.4, entity widgets allow you to control how entire entities (and their occurrences) look inside a component. This is useful if you want to customize the visualization of groups of data instead of working field by field.

Forms and Default Entity Widgets

When working with Form components, there is always an implicit entity widget. This means that even if you don’t add one explicitly, Uniface gives you a default way to control how the entity appears. You can also replace it with a Grid widget, which is helpful when you want to display entities in a tabular view.

Dynamic Server Pages (DSPs)

In DSPs (Dynamic Server Pages), entities behave a little differently. Here, the entity widget properties cannot be set declaratively in the inspector. Instead, you need to use ProcScript or JavaScript to define them. This gives you more dynamic control, especially when the UI should react to runtime data.

Working with Properties

You can control and query entity widget properties with functions like:

  • $EntityProperties β€” to get or set properties for all occurrences
  • $CurEntProperties β€” to adjust properties of the current entity
  • $curoccvideo β€” to change how the current record looks (for example, color or emphasis)

An important detail: these functions only return properties if they were explicitly set (either in the inspector or through code). If nothing was set, they return an empty result.

Example: Setting a Background Color 🎨

Imagine you want to highlight a current record in a form. You could use:

; Inside ProcScript
$curoccvideo("backcolor") = "yellow"
Enter fullscreen mode Exit fullscreen mode

This would set the background color of the current occurrence to yellow, making it stand out for the user.

When to Use Entity Widgets?

Use entity widgets when:

  • You need to style or visually emphasize records
  • You want consistent formatting across all occurrences of an entity
  • You are working with grids or lists of data
  • You need dynamic runtime adjustments through scripts

Conclusion

Entity widgets in Uniface 10.4 make it easier to manage how entities look and feel in your applications, whether in forms or server pages. By combining declarative styling and ProcScript/JavaScript, you can create flexible and user-friendly interfaces. ✨

Uniface Entity Widgets ProcScript User Interface

Top comments (0)