Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uakari.primate.wisc.edu!gem.mps.ohio-state.edu!wuarchive!psuvax1!shire.cs.psu.edu!zaccone From: zaccone@shire.cs.psu.edu Newsgroups: comp.sys.mac.programmer Subject: mouse down in grow box Keywords: mouse down grow box Message-ID: <1989Oct6.113511.3400@psuvax1.cs.psu.edu> Date: 6 Oct 89 11:35:11 GMT Sender: news@psuvax1.cs.psu.edu Reply-To: zaccone@shire.cs.psu.edu () Organization: Penn State University Lines: 26 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