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 (max–char–width) and the average width of all characters in the font (ave–char–width) 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:
- If the value is 3 characters or less, Progress multiples the length of the string times the width of the widest character in the font: string–length * max–char–width
- If the value is more than 3 characters, but less than 13, Progress uses the widest character in the font for 3 characters and the average character for the remaining characters: (3 * max–char–width) + ((string–length – 3) * ave–char–width)
- If the value is 13 characters or more, Progress multiplies the length of the string times the average character width for the font: string–length * ave–char–width.
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: string–length * ave–char–width.
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:
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 |