Width – XpressDox

Before the advent of the Width command, the widths of controls on the interview would be variable, as the right hand side of the control is a fixed distance from the edge of the interview form.  This gives the interview a uniform look, but this can become tedious to look at, and can give the wrong impression when, for example, an area where a number is to be entered (like a price or a number of items), which is typically something like not more than 10 digits,  is just as wide as the area where a description of goods is to be entered.  And the description of goods can be many characters long.

The Width command enables the template author to indicate that the width of the relevant control in the interview should be a fixed number of characters.  Thus, for example, the command

«Width(NumberOfItems,3)»

will make sure that the control on the interview for data element NumberOfItems will be only 3 characters wide.

This does not mean 3 digits, as the unit of width used is the “em” – in other words the width of the letter “M” in the relevant font.

The Width setting is also NOT a restriction on the number of characters that can be typed.  The command above will create a control that accepts about 5 digits (because they are narrower than an “M”) but will allow a value of any number of digits to be typed into that control.

It will sometimes be that there are a number of controls one under the other which should, from an aesthetic point of view, all be set to the same width.  This can be done with one command:

«Width(Firstnames,Lastname,AddressLine1,AddressLine2,City,20)»

This will set the width for the controls for all 5 of those data elements to 20 characters.

Fine Tuning

Particularly in conjunction with the HzGroup command, it sometimes becomes useful to adjust the width of a control not just by a number of characters, but to fine-tune the width by a number of pixels.  This can be done by specifing an additional number of pixels after the character width as follows:

«Width(NumberOfItems,3.2)»

This will set the width of the control to 3 characters plus 2 pixels.