zaccone@shire.cs.psu.edu (10/06/89)
The Macintosh Programming Primer contains a program called the Event
Tutor. Here is how the program handles a mouse down event in the grow
box. The code makes sense to me, except that I don't understand the
purpose of the GetPort and SetPort function calls. I've tried taking
them out to convince myself that they are necessary, but I still don't
understand why they are needed. Can someone explain this to a Mac
programming novice?
case inGrow:
windSize = GrowWindow( whichWindow, gTheEvent.where, &gSizeRect );
if (windSize != 0 ){
GetPort( &oldPort );
SetPort( whichWindow );
EraseRect( &whichWindow->portRect );
SizeWindow( whichWindow, LoWord( windSize ), HiWord( windSize ),
NORMAL_UPDATES );
InvalRect( &whichWindow->portRect);
SetPort( oldPort );
}
break;
Rick Zaccone
zaccone@bknlvms.bitnet
zaccone@sol.bucknell.edu