Progress
Programming
Handbook


Format and Size

By default the size of a fill-in on the screen is determined by its format and the font used when the code is compiled. For example, if a fill-in has a format of x(8) then 8 characters are visible on the screen. The external width of the fill-in might be 9 or 10 characters to allow for the side borders.

For proportional fonts on Windows, Progress considers the width of the widest character in the font (maxcharwidth) and the average width of all characters in the font (avecharwidth) to determine the width of a fill-in. Also, the rules differ for the default system font versus any other font.

The rules for the default system font are as follows:

For all other fonts than the default system font, Progress multiplies the length of the string (for all string lengths) times the average character width for the font: stringlength * avecharwidth.

Sometimes you want to explicitly set the size of the widget regardless of format. To prevent Progress from resizing the field to fit the format, either set the AUTO–RESIZE attribute to FALSE or explicitly specify a size within the VIEW–AS FILL–IN phrase or by setting the fields WIDTH and HEIGHT attributes.

The following example defines two variables that are viewed as fill-ins. For the first, filename, the procedure specifies a large format but a smaller size. For the second, no_scroll, the default format, x( 8 ), and size are used:

p-fillin.p
DEFINE VARIABLE filename AS CHARACTER FORMAT "X(80)"
                            VIEW-AS FILL-IN SIZE 42 BY 1.
DEFINE VARIABLE no-scroll AS CHARACTER.

DEFINE FRAME f
       filename no-scroll.

UPDATE filename no-scroll WITH FRAME f. 

Because the procedure specifies a width of 42 character for filename, only about 40 characters are visible on the screen (the other character positions are used for side borders). Because the format is greater than the number of visible characters, filename becomes a horizontally scrolling field. When updating the field, when you type past the right edge of the field, the value automatically scrolls so that you can enter more characters.

For more information, see Widgets and Handles."


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095