DEV Community

Peter + AI
Peter + AI

Posted on

🎨 Understanding Widgets in Uniface 10.4

πŸ€– This blog post was created with AI assistance to help explain Uniface concepts in simple terms.

If you're working with Uniface, you've probably heard the term "widgets" a lot. But what exactly are they? Let's break it down in simple terms! πŸ’‘

What Are Widgets? πŸ–±οΈ

In Uniface, widgets are user interface controls. Think of them as the building blocks of your application's visual interface. They do three main things:

  • Display data values to users
  • Control how users can modify those values
  • Determine how objects look on screen

For example, a widget could be a text box where users type information, a checkbox they can click, or a dropdown list they can choose from.

Explicit vs Implicit Widgets πŸ”„

Uniface has two types of widgets, and understanding the difference is important:

Explicit Widgets βœ…

These are widgets you choose yourself. For fields and entities, you get to pick which widget to use. Some examples:

  • Should your field be an edit box (text input) or a check box?
  • Do you want a dropdown list or radio buttons?
  • Should it display as a picture or a button?

Real-world example: Imagine creating a form for user preferences. For the "Subscribe to newsletter" field, you might choose a checkbox widget because it's a simple yes/no choice. For "Country selection," you'd pick a dropdown list widget because there are many options.

Implicit Widgets πŸ”’

These are widgets that are automatically assigned - you don't choose them. They're built-in for:

  • Components
  • Entity occurrences

For example, in desktop applications, windows are the implicit widget of components. You can customize window properties, but you can't swap the window widget for something else.

πŸ’‘ Quick Tip: When developers say "widgets," they usually mean field-level widgets (the explicit ones you can choose).

Widget Properties πŸŽ›οΈ

Every widget comes with properties that control how it looks and behaves. You can set these properties in three places:

  1. The usys.ini configuration file
  2. Object definitions in your application
  3. Script code at runtime

Properties can include things like background color, font size, or whether the field is read-only. If you don't set a property, the widget often inherits it from its parent object.

Example: If you don't define a background color for a text field, it might inherit the color from its parent form or entity.

What Affects Widget Appearance? 🎭

The way a widget looks at runtime depends on several factors:

  • Component Type: Forms, Dynamic Server Pages, and Static Server Pages each have their own set of supported widgets with different properties
  • Runtime Environment: The platform (web, desktop, or mobile), operating system, and browser all play a role
  • Property Values: Both the values you set and the default values from configuration files

Real example: A Dynamic Server Page can run on Windows, Android, and iOS, and in different browsers. The same widget might look slightly different on Chrome versus Safari, or on an iPhone versus an Android phone.

Physical vs Logical Widgets πŸ”§

Here's where it gets a bit technical, but stay with me! 😊

Logical Widgets

These are the widget names you see when developing. A logical widget is essentially a named configuration of a physical widget. It's like a preset that says "this widget should have these specific properties."

Physical Widgets

These are the actual, underlying widgets. One physical widget can have multiple logical widgets that configure it differently.

Think of it this way: A physical widget is like a blank smartphone. Logical widgets are like different phone configurations - one might be the "Gaming Phone" setup with specific settings, another might be the "Business Phone" setup with different settings. They're all the same phone (physical widget), just configured differently (logical widgets).

Key Takeaways 🎯

  • Widgets are the UI controls that make your application interactive
  • You choose explicit widgets for fields and entities
  • Implicit widgets are built-in and automatic
  • Properties control how widgets look and behave
  • The same widget can look different depending on platform and browser
  • Logical widgets are configurations of physical widgets

Why This Matters πŸ’ͺ

Understanding widgets is crucial for creating user-friendly Uniface applications. When you know how widgets work, you can:

  • Choose the right widget for each data type
  • Create consistent user experiences across platforms
  • Customize appearance to match your brand
  • Troubleshoot display issues more effectively

Whether you're building desktop applications, web apps, or mobile solutions with Uniface, widgets are the foundation of your user interface. Master them, and you'll create better applications! πŸš€


Have you worked with Uniface widgets? What challenges have you faced? Share your experiences in the comments below! πŸ‘‡

Keywords:

uniface, widgets, user interface, application development

Top comments (0)