Widget size within hbox tags

By default, the real width of BUTTONEDIT, DATEEDIT, DATETIMEEDIT and COMBOBOX widgets are computed as follows:

if item-tag-width > 2
   real-width = item-tag-width - 2
else
   real-width = item-tag-width

Where item-tag-width represents the number of characters used in the form layout by the item tag, to define the width of the element.

If the default widget size computing does not satisfy the needs, it is possible to specify the exact with of a BUTTONEDIT, DATEDIT or COMBOBOX with an hbox tag, combined to the SAMPLE attribute.

The hbox tag can be used with a : (colon) and - (dash) marker to define the exact number of characters the field can display, while the SAMPLE attribute will define the size.

For example:
LAYOUT
GRID
{
 ButtonEdit A  [ba     ]
 ButtonEdit B  [bb:    ]
 ButtonEdit C  [bc   : ]
 ButtonEdit D  [bd  -: ]
}
END
END
ATTRIBUTES
BUTTONEDIT ba = FORMONLY.ba, SAMPLE="0",  ACTION=zoom1;
BUTTONEDIT bb = FORMONLY.bb, SAMPLE="M",  ACTION=zoom2;
BUTTONEDIT bc = FORMONLY.bc, SAMPLE="Pi", ACTION=zoom3;
BUTTONEDIT bd = FORMONLY.bd, SAMPLE="0",  ACTION=zoom4;
END

Here the ba item tag occupies 7 grid columns and gets a real width of 5 (7-2). The SAMPLE attribute makes the edit field part as large as 5 characters '0' in the current font, so with this field you can input or display only 5 digits.

The bb item tag, which is in an hbox tag that occupies 7 grid columns, gets a width of 2. Since the SAMPLE attribute is "M", one can input 2 characters as wide as an "M".

The bc item tag, which is in an hbox tag that occupies 7 grid columns, gets a width of 3 (5-2). Since the SAMPLE attribute is "Pi", the edit field part will be as large as the word "Pi". (If SAMPLE contains more than 1 character it must have the same number of characters as in the field definition).

When using an hbox tag, one can explicitly specify the width of the field with the dash size indicator: The bd, which is in an hbox tag that occupies 7 grid columns, gets a width of 4 (because of the dash size indicator). Since the SAMPLE attribute is "0", the edit field part will be as large as 4 digits.