OutGText% Works Only on First Call If WINDOW Invoked; UI Font (68588)






This article was previously published under Q68588

SUMMARY

Using the OutGText% function more than once does not display the text in the same location if you have invoked the SCREEN command prior to invoking OutGText%. GTextWindow must be called before any OutGText% commands. The GTextWindow subroutine is in the FONTB.BAS file, and also in the UITBEFR.QLB Quick library.

This information applies to the User Interface (UI) Toolbox font procedures in Microsoft Basic Professional Development System (PDS) versions 7.0 and 7.1 for MS-DOS. (See GTextWindow in the README.DOC file.)

MORE INFORMATION

The procedure OutGText% initializes the screen to its full-screen parameters before displaying the user's text. To reinitialize the screen back to its original user-specified parameters, GTextWindow must have been called. GTextWindow stores the screen coordinates for later use (for example, in the OutGText% function).

Because the WINDOW statement uses the same parameters as GTextWindow, you may want to include the command WINDOW(X1,Y1,X2,Y2) in the GTextWindow procedure, and substitute the GTextWindow call whenever referencing the WINDOW statement.

Code Example

The code below demonstrates the correct method to display the text "Hello world" in the location (0,100). If GTextWindow is not called, "Hello world" will be displayed twice in two different locations.
SCREEN 9
FontNum% = RegisterFonts("TMSRB.FON")
var1% = LoadFont%("N4,N5,N6")
a$ = "Hello world"
CALL GTextWindow(-200, -200, 200, 200, FALSE)   'store coordinates
WINDOW (-200, -200)-(200, 200)
PSET (0, 100)
var1% = OutGText%(0, 100, a$)
var1% = OutGText%(0, 100, a$)
PSET (0, 100)
END
				
According to the README.DOC file for Basic PDS 7.0 and 7.1, after the first call to OutGText to output text, you must precede each subsequent call to OutGText with a call to GTextWindow to preserve logical coordinates of the window.

Modification Type: Minor Last Reviewed: 1/9/2003
Keywords: KB68588