PICTURE ON Does Not Capture Picture after WINDOW Change (50806)



The information in this article applies to:

  • Microsoft QuickBASIC Compiler for the Apple Macintosh 1.0
  • Microsoft BASIC Compiler
  • Microsoft BASIC Interpreter for Apple Macintosh 2.0
  • Microsoft BASIC Interpreter for Apple Macintosh 2.1
  • Microsoft BASIC Interpreter for Apple Macintosh 3.0

This article was previously published under Q50806

SUMMARY

The PICTURE ON/OFF statements cannot capture graphics sent to several different WINDOWs. PICTURE ON only captures a graphics image in the WINDOW that is active when the PICTURE ON statement is executed. If the WINDOW being output to is changed, or another WINDOW is created after the PICTURE ON statement, any graphics output to that other WINDOW is not captured.

MORE INFORMATION

The correct order of statements for capturing a PICTURE$ with PICTURE ON/OFF is as follows:

  1. Create the WINDOW you want to use with the WINDOW statement, or make an already existing WINDOW active with the WINDOW OUTPUT statement. Either one of these actions will set the currently active output WINDOW. If the program is just using the default WINDOW, this step is not necessary.
  2. Use PICTURE ON to begin recording graphics output to the WINDOW you just made active.
  3. Normally, PICTURE ON issues a CALL to HIDEPEN. This means that to watch the graphics as they are being drawn and recorded, you must invoke SHOWPEN immediately after the PICTURE ON statement.
  4. While the graphics are being drawn, do not make any other WINDOW active by issuing a WINDOW statement or WINDOW OUTPUT statement. Any graphics output to a WINDOW other than the one that was active when the PICTURE ON was activated will not be recorded.
  5. When the graphics are complete, use the PICTURE OFF statement to terminate recording of graphics.
  6. You now can invoke the PICTURE$ function to return a string containing the graphics information [ x$=PICTURE$ ]. You can redraw the stored picture with the PICTURE statement [ PICTURE,x$ ].

Code Example

The following code example demonstrates the correct steps described above:
ScrW% = SYSTEM(5) ' Get the screen width and height.
ScrH% = SYSTEM(6)
' Create and set an active WINDOW.
WINDOW 2,"Recording Picture",(10,40)-(ScrW%-20,ScrH%-20),5
PICTURE ON    ' Start recording graphics.
SHOWPEN          ' View the graphics as they draw.

FOR W=9 TO 20.3 STEP .01
     a=60
     x=R*COS(W)
     y=R*SIN(W)
     dr=R-R*SIN(W-.05)
     dy=y-R*SIN(W-.05)
     dx=x-R*COS(W-.1)
     R=a
     PSET(300+x-x*SIN(W/2)*dx,200+y+y*COS(W/2)*dy)
NEXT W
scrn:
PICTURE OFF
x$=PICTURE$
WINDOW CLOSE 2
' Output now goes to the default WINDOW.
PICTURE(1,1)-(ScrW%,ScrH%),x$    ' Scales the size of output
LOCATE 10, 10
INPUT "Hit any key to end the program.", a$
END
				

Modification Type:MinorLast Reviewed:8/16/2005
Keywords:KB50806