VIEW SCREEN Parameters Passed through CHAIN Using BRUNxx.EXE (43900)






This article was previously published under Q43900

SUMMARY

An "Illegal function call" may be generated by a graphics PUT statement under the following conditions:

  1. The first Basic program performs a VIEW SCREEN statement to set up a graphics area.
  2. The first program CHAINs to a second Basic program.
  3. The second program attempts to perform a graphics PUT statement outside the boundaries of that previously defined VIEW SCREEN.
This error occurs only when the Basic programs are run from the QB.EXE environment or when compiled requiring the run-time module (BRUNxx.EXE in QuickBasic and the Basic compiler; BRT70xxx.EXE in Basic PDS Version 7.00).

This information applies to Microsoft QuickBasic Versions 4.00, 4.00b, and 4.50 for MS-DOS, to Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS and MS OS/2, and to Microsoft Basic PDS Version 7.00 for MS-DOS and MS OS/2.

MORE INFORMATION

Using the VIEW SCREEN statement in Basic allows you to create a virtual view port for all graphic images created or PUT on the screen. Graphic images are displayed on the screen only if they fall in that virtual view port. This feature can be a useful for writing graphic routines that are to be used with CHAINed QuickBasic programs.

This error can be avoided by using any or all of the following methods:

  1. Changing screen modes with the SCREEN statement.
  2. Issuing another VIEW SCREEN statement with parameters large enough to handle additional graphic images.
  3. Compiling the programs with the /O (stand-alone) switch.

Code Example

The following code generates the "Illegal function call" error as soon as the image is displayed outside of the previously defined VIEW SCREEN port.
' PROGRAM:   A.BAS
SCREEN 8
VIEW SCREEN (250,75)-(390,125)
LINE (250,75)-(390,125), ,B
PRINT "This is the View Screen Box"
LOCATE 22,1
PRINT "Press a key to CHAIN to B.BAS"
SLEEP
CHAIN "B.BAS"
END

' PROGRAM:   B.BAS
DIM C#(3000)
SCREEN 8
LINE (250,75)-(390,125), , B
LINE (300,85)-(350,110), 1, BF
GET (300,85)-(350,110), C#
FOR i = 1 TO 100
   PUT (225 + i, 50 + i), C#  'This will generate the error as soon as
NEXT i                               'the box leaves the bottom of the
views
END
				

Modification Type: Minor Last Reviewed: 1/8/2003
Keywords: KB43900