Logical Widgets

Logical widgets are named configurations of physical widgets. A single physical widget may therefore have multiple logical widgets mapped to it.

For fields, logical widgets provide the only way that physical widgets can be addressed.

Purpose of Logical Widgets

Logical widgets make it possible to:

  • Define custom logical widgets by declaring a name, mapping it to a widget, and setting the properties as desired. For example, you could define your own edit box as follows:
    BlueEditBox=ueditbox(font=editfont;autoselect=off;backcolor=steelblue)
  • Change or add widget property values a default logical widget. The following example changes the size of ListBox logical widget:
    ; ListBox=htmlselect(html:size=3) ; standard definition
    ListBox=htmlselect(html:size=5)  ; 
  • Change the widget to which the logical widget is mapped. The following example, changes the mapping of the Tab logical widget from utab to utabex (which provides many more styling properties). This enables you to take advantage of these properties without changing the logical widget used in existing component definitions:
    ;Tab=utab    ; standard Uniface mapping
    Tab=utabex   ; custom mapping to the utabex widget
    TabEx=utabex

Default Logical Widgets

Logical widgets are defined in the application assignment file, which by default is usys.ini. Uniface provides a set of default logical mappings for use in Form and Dynamic Server Page components, but you can define your own.

The logical widgets defined in usys.ini are displayed in the Widget Type drop-down list so that you can select the one to use for a specific object. (Widgets for fields in Static Server Page components are Uniface-specific XHTML controls and do not support logical widgets. )

For example, the following logical widgets both map to the ucmdbutton widget for Forms but set different properties:

;usys.ini
[widgets]
CommandButton=ucmdbutton(tooltip=on;font=buttonfont;actoneachclick=on)
UnifaceButton=ucmdbutton(tooltip=on;font=buttonfont;representation=uniface)

Similarly, the following logical widgets map to the same DSP widget (htmlinput), but set different properties, resulting in very different representations of the field:

;usys.ini
[webwidgets]
EditBox=htmlinput(html:type=text;detail=dblclick)
CommandButton=htmlinput(html:type=button;clientsyntaxcheck=false)[syntax=ned]
CheckBox=htmlinput(html:type=checkbox)			

The property values defined in logical widget definitions are used as the default each time that the logical widget is used in the application. However, they can be overridden if the property is set to another value in the Properties Inspector, or in script.

Defining Logical Widgets

To create your own logical widgets, or edit the default set, you must define them in the appropriate section of usys.ini:

Logical widgets have the following syntax:

LogicalWidget = PhysicalWidget(Property=Value{;PropertyN=ValueN)

When creating your own logical widgets, consider the following:

  • The default templates provided by Uniface use the default logical widgets. To make it easier to create fields that use your logical widgets, consider create your own templates too. For more information, see Templates and Palettes.
  • The order in which widgets are listed in usys.ini is the order in which they are listed in the Widget Type property, so you can arrange them in your own preferred order.

Naming Rules for Logical Widgets

If you define your own logical widgets, follow these guidelines:

  • Maximum length: 16 characters
  • Valid characters: A-Z, 0-9
  • First character must be a letter (A-Z)
  • Uniface reserved words are not allowed
  • Do not use widget names that begin with IDE or IDF. These are reserved for internal use.
  • Do not use a name that is the same as a physical widgets (and do not add a custom physical widget using the same name as any existing logical widget)
  • Avoid names starting with the letter U to prevent conflicts with Uniface objects

Related Topics