Database Solutions - Hints & Tips

Tip 10:
Configuring Widgets from the UNIFACE '.ini' File

The widgets available on the UNIFACE tool palette within the UDE can be configured to suit an individual developer’s preferences. There are two ways this can be achieved.

Making widgets appear directly on the tool-palette (rather than under the subset Widget Menu)

In UNIFACE’s ‘.ini’ file, there is a section heading "[gfp]". All UNIFACE logical widgets can be added here (to the "widgets" option), allowing developers immediate access to certain widgets from within the UDE. For example, the following code is taken from an ‘.ini’ file.

[gfp]

widgets=EditBox, CommandButton, RadioGroup, CheckBox, DropDownList

This means that the above widgets will appear directly in the tool-palette window, and not underneath the "Widget Menu" button on the tool-palette.

So instead of the tool-palette and widget menu looking as follows,

tip10_img01.gif (8356 bytes)

It will look as follows, with the Editbox, CommandButton, RadioGroup, Checkbox and DropDownList appearing directly on the Tool Palette.

tip10_img02.gif (7543 bytes)

This can speed up development time as the UDE can be tailored slightly for each developer, although care must be taken in multi-user environments with only one ".ini" file.

The tool-palette is dynamic; i.e., you do not have to exit from UNIFACE to re-load the palette. Saving the contents of the ".ini" file is enough.

Creating new logical widgets with different properties to the default physical widgets

A physical widget is either a widget supplied with UNIFACE or a custom widget (created with 3GL). Physical widgets cannot be modified or painted on components; instead they must be mapped to logical widgets. Logical widgets can be defined in the UNIFACE ‘.ini’ file; the table below lists several of the logical widgets, and their default properties, included in UNIFACE’s default ‘.ini’ file.

Logical widget Physical widget
EditBox ueditbox(font=editfont;autoselect=on)
CheckBox ucheckbox
Combobox ucombobox(font=listfont)
CommandButton ucmdbutton(tooltip=off;font=buttonfont)
DropDownList udropdownlist(font=listfont;forcefit=on)
Label (cannot be customised)
ListBox ulistbox(font=listfont)
NoEditBox ueditbox(font=editfont;3D=off,frame=on)
MessageBox ueditbox(font=editfont)
RadioGroup uradiogroup(font=label)
SpinButton uspinbutton(autoselect=on)
Tab Utab

A developer is able to customise most of these widgets so that they have certain default properties. This is achieved by creating new logical widgets based on the standard UNIFACE physical widgets, and changing their associated properties. These new logical widgets are defined in the "[widgets]" section of the ".ini" file.

As an example, suppose we have a developer,  who wishes to customise several of the widgets available to suit his development environment and programming style. To accomplish this, the ".ini" file contains the following extra lines underneath the "[widgets]" section heading.

[widgets]

WickedBox=ueditbox(font=buttonfont; MultiLine=True; HScroll=False; wordwrap=true)

GeezerButton=ucmdbutton(tooltip=on; font=monohuge)

NastyCheck=ucheckbox(tristate=false)

These new widgets will appear under the "Widget Menu" button on the Tool Palette (or directly on the tool-palette if included in the "[GFP]" section of the ".ini" file) and should be treated identically to normal widgets. So, when the new EditBox widget "WickedBox" is painted, it will, by default, allow multi-line data entry. The command-button widget "GeezerButton" will allow ToolTips by default, and all text on the button will appear in "monohuge" font. The new checkbox widget "NastyCheck" will not allow tri-state entry.

As an example,

tip10_img03.gif (7299 bytes)

This technique is particularly useful for situations arising on customer sites, where particular standards may be required for each widget type.

Problems can arise if forms are exported to a different environment containing a different ".ini" file, as the new widget definitions will probably not exist in this environment.

compuware_01.gif (3977 bytes)


Copyright ©2000 OCS Consulting plc

dbs_block_logo.gif (2150 bytes)
Refresh Frames