Please enable JavaScript to view this site.

A-Shell Reference

Navigation: Development Topics > GUI Development > GUI Extensions

Proportional Font Text Objects

Scroll Prev Top Next More

You can convert ordinary PRINT statements, which output fixed pitch text to the screen, into proportional text objects using any of the following methods:

TPRINT: If you compile with the /X:2 switch, you can use the TPRINT statement, which functions exactly like PRINT (to the screen) except that it uses the current default proportional GUI font. (You can override that font via Settings menu.)

DPRINT: Nearly identical to TPRINT, except it creates a sunken panel for the output text, and thus is likely to be used for printing "Data" (whereas TPRINT is for "Text"). Note that the size of the sunken panel will be based on the size that would be needed if the standard fixed pitch font was being used. Also note that when INFLD is in GUI mode (type |G), it displays the field (when not actively editing it) using the DPRINT style.

EPRINT. Similar to DPRINT, except that it uses an EDIT control to display the string, rather than a sunken static text control.  Note that EPRINT adds one to the width of the control if the width was otherwise going to be only one column; this should eliminate most of the cases where upper case text is truncated, without causing too much havoc with screen layouts.

In a text-only environment (i.e. under Unix when the terminal driver name does not end in "G"), TPRINT, DPRINT and EPRINT will revert to acting just like PRINT.

SET.LIT supports an AUTOTPRINT setting that causes existing PRINT statements to act as if they were TPRINT. This is the fastest way to convert your entire application from fixed to proportional text, and to size up the areas where you may have to make some formatting adjustments.

The A-Shell compiler will compile TPRINT and DPRINT as if they were PRINT, if the /X:2 switch is not set. This might allow you to generate a RUN file compatible with AMOS even though your program uses TPRINT and DPRINT.

Note that DPRINT applies "intelligent justfication" logic to decide whether the field should be right, left or center justified. If both the first and last character of a string expression are spaces, then it center justifies. If the first character is a space or monetary symbol and the last character is a non-space, then it right justifies. Otherwise it left justifies. This should result in the desired alignment for data fields in most cases, although you may have to adjust any fields in which you were intentionally counting on the fixed width of spaces. In the proportional font world, you cannot count on spaces for positioning of text; always use explicit Tab(x,y) statements for each output token to avoid confusion.

Subtopics

Alignment Problems with Text