Microsoft KB Archive/62271

= BUG: Mac QB Forgets Clip Region When Changing Between Windows =

Article ID: 62271

Article Last Modified on 11/21/2006



This article was previously published under Q62271



SYMPTOMS
The QuickBasic MBLC routine SetClip can be used to set the clipping region for the current output WINDOW and GraphPort. However, if a clipping region is set in one WINDOW, and the active window is then changed to a different WINDOW, the clipping region set for the previous WINDOW will be &quot;forgotten.&quot; The example below demonstrates this behavior.

Microsoft has confirmed this to be a bug in Microsoft QuickBasic 1.00 for the Macintosh. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.



MORE INFORMATION
To work around the problem, reset the clipping region whenever you set a WINDOW to be the active WINDOW again. For example, in the code example below, SetClip is used in WINDOW 1. WINDOW 2 is then set to the current WINDOW. Then WINDOW 1 is made the current WINDOW again. When WINDOW 1 becomes the current WINDOW again, SetClip should be used to reset the clipping region.

This following code example demonstrates the problem. To show the workaround, uncomment the line marked as the workaround.

Code Example
ScreenWidth% = SYSTEM(5) ScreenHeight% = SYSTEM(6) CenterX% = ScreenWidth% / 2 CenterY% = ScreenHeight% / 2 x1% = CenterX% /4 : x2% = CenterX% - 40 y1% = CenterY% /2 : y2% = CenterY% + 20

WINDOW 2, &quot;window 1&quot;,(CenterX%, 20) - (ScreenWidth%,_          ScreenHeight%), 7 WINDOW 1, &quot;window 1&quot;,(20, 20)-(CenterX%,_          ScreenHeight%), 5

' Set a small, square clipping region CALL SetClipRegion(x1%, y1%, x2%, y2%)

'Draw lines to show the boundaries of the clip region 'Lines are drawn only within the clip region FOR n = 1 TO 100 LINE (1, n * 4)-(ScreenWidth%, n * 4) NEXT n ' Toggle between the windows. WINDOW 2 INPUT &quot;HIT RETURN TO CONTINUE&quot;, a$ WINDOW 1

'***** Uncomment the following line to show the workaround **** ' CALL SetClipRegion(x1%, y1%, x2%, y2%) '************************************************************** ' Draw Circles to show the current clip region x1% = CenterX% / 2 FOR I = 1 TO 30 CIRCLE (x1%, CenterY%), I * 5 NEXT I INPUT &quot;HIT RETURN TO EXIT THE PROGRAM&quot;, a$

WINDOW CLOSE 1 WINDOW CLOSE 2

END

SUB SetClipRegion(x1%, y1%, x2%, y2%) STATIC R& = 0 : SetRect c%(0), x1%, y1%, x2%, y2% NewRgn R& : OpenRgn FRAMERECT VARPTR(c%(0)) CloseRgn R&    SetClip R&     DisposeRgn R& END SUB

Additional query words: MQuickB

Keywords: kbbug KB62271

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.