[comp.sys.mac.programmer] SrollRect Hassles

sagar@psu-cs.UUCP (Arun Sagar) (03/05/89)

Hi,
	This may be a stupid question, but i haven't found a satisfactory explanation yet. I am using:
MacII w/ 4bit video card, 1Meg, LSC3.01, Sys/Find6.01.

When i try the following:

SetPort(currentPort);
ScrollRect(&currentPort->portRect,dh,dv,NULL);

....

	it scrolls alright, but doesn't erase the region that it left behind
like it says in IM-I.

When i try:

ScrollRect(&currentPort->portRect,dh,dv,updateRgn);
EraseRgn(updateRgn);

	it does what i want it to do.  Any idea what's up? I don't know what's happening, but do recall that before i *debugged* my code, i didn't need that EraseRgn() call.

sagar@psu-cs.

jackiw@cs.swarthmore.edu (Nick Jackiw) (03/06/89)

In article <1733@psu-cs.UUCP> sagar@psu-cs.UUCP (Arun Sagar) writes:
> 
> When i try the following:
> 
> SetPort(currentPort);
> ScrollRect(&currentPort->portRect,dh,dv,NULL);
> 
> 	it scrolls alright, but doesn't erase the region that it left behind
> like it says in IM-I.
> 
> sagar@psu-cs.

Two possibilities. ScrollRect is supposed to fill in the "scrolled out"
region with the curPort's background pattern&color. Are these set properly
for you?

Second, note that I.M. doesn't say you can pass a null updateRgn as your
last parameter, the way you CAN pass a null maskRgn to copybits. I've had
some difficulties (i. e. crashes) with attempting to pass a NIL handle for
updateRgn.  Try instead to pass an EMPTY rgn:

aRgn:=NewRgn;
ScrollRect(...,aRgn);
DisposeRgn(aRgn);

That might do the trick.




-- 
+-------------------+-jackiw@cs.swarthmore.edu / !rutgers!bpa!swatsun!jackiw-+
|  nicholas jackiw  | jackiw%campus.swarthmore.edu@swarthmr.bitnet           |
+-------------------+-VGP/MathDept/Swarthmore College, Swarthmore, PA 19081--+
"Ah...I've got this CHRONIC pain."                             _True Believer_

kaufman@polya.Stanford.EDU (Marc T. Kaufman) (03/08/89)

In article <2525@ilium.cs.swarthmore.edu> jackiw@ilium.UUCP (Nick Jackiw) writes:

>Second, note that I.M. doesn't say you can pass a null updateRgn as your
>last parameter, the way you CAN pass a null maskRgn to copybits. I've had
>some difficulties (i. e. crashes) with attempting to pass a NIL handle for
>updateRgn.  Try instead to pass an EMPTY rgn:

->aRgn:=NewRgn;
->ScrollRect(...,aRgn);

	at this point, do: InvalRgn (aRgn);
	to add the fresh area to the update area.

->DisposeRgn(aRgn);

Marc Kaufman (kaufman@polya.stanford.edu)