Column Width (ColumnWidth)

Uniface list of fields and their associated column width in characters or pixels. The maximum length of this value is 2046 characters (including list separators).

ColumnWidth="Field1=Size{!; Field2=Size}"

Value Description
Field Name of a field to resize
Size Positive integer value defining the width of the column. By default, the width is in Uniface character cells, but adding px to the value sets the width in pixels; for example, 100px.

Description

The default width of columns is determined by the form layout as designed in the Uniface IDE. You can change this at runtime if you want to display more of the field contents. Alternatively, you can use the Hover View property of Edit Box and Picture widgets to display the field contents in a tool tip.

If you set the ColumnWidth in ProcScript, keep in mind that the end user can also change the width of columns by dragging the border of the column, and this always overrides the column width as set in the layout or in ProcScript. Uniface stores the column width in the registry, so that the form is always restored to the appearance last set by the end user.

Note:  The ColumnWidth property is ignored if the AutoSizeableColumn is set for the a specified field.

Setting in ProcScript

Use $entityproperties to set (or get) the value of the ColumnWidth property. If the list is longer than 2046 characters (including separators), Uniface will not be able to extract the information from the items that fall outside this maximum.

If you are setting other properties with $entityproperties, and you are setting the width of more than one field, use the subfield separator Gold! Gold; (!;) to specify the value of ColumnWidth. For example:

$entityproperties(EMPLOYEE) = "ColumnWidth=NAME=50!;BIRTHDAY=20;

When using $entityproperties to set the ColumnWidth in the Exec operation, follow it with a show statement. (This is not required in triggers.)

Dynamically Set the Column Width

Given that the EMPLOYEE entity is represented as a grid, the following ProcScript instruction sets the column width of the Name and Birthday columns to 40 and 20 respectively, and attaches the grid to the left border of the window

$entityproperties(EMPLOYEE) = "ColumnWidth=NAME=50!;Birthday=20;attach=left"

Setting Column Widths in Pixels

The following ProcScript sets the column widths of two fields as pixels

$entityproperties(EMPLOYEE) = "ColumnWidth=NAME=100px!;BIRTHDAY=120px"

Get List of Entity Fields and Their Width

The following ProcScript instruction returns a Uniface list of fields and their width in character cells.

vColumns = $entityproperties(EMPLOYEE>)
;Result: vColumns =  NUMBER=8;NAME=40;BIRTHDAY=20

Applies to

egrid (Grid)

Related Topics