Article View: comp.sys.next.programmer
Article #112Re: Trouble adding printing to Bruce Webster's Scribble
From: Mike Ferris
Date: Mon, 02 Nov 1992 17:16
Date: Mon, 02 Nov 1992 17:16
33 lines
2249 bytes
2249 bytes
David J. Finton writes > >I've just finished the Scribble IB tutorial in Bruce Webster's >'The NeXT Book'. Pretty cool! But I wanted to learn how to >add printing, so I tried adding another menu cell, labeled it >'Print', and connected it to the PaintView object (which is the >window you 'scribble' in) by the method printPSCode. Sure enough, >'Print' worked, but the only thing that prints is the background-- >not any of the 'scribbling'. Can anyone tell me what's missing? The PaintView object you refer to is not capable of printing as it is written. This is because it does not know how to -drawSelf correctly. If memory serves, the -drawSelf method only erases the view and draws the background. The -mousedown method then draws lines, but they get drawn only into the window's buffer. When you print, the printing code calls drawSelf on the view. The PaintView would have to be extended to cache the scribbling in some way (there are many ways you might do this) so that the -drawSelf method can reproduce the scribbles. If your view properly implements drawSelf, printing is a breeze, but if, like PaintView, you try to take advantage of the window buffer to keep your drawing, you're kind of screwed when it comes to printing. To illustrate, try making the window nonRetained in IB and see what happens. When the window is nonretained, it will drawSelf whenever it needs to update anything and you'll see the consequences of PaintView's implementation. -- ____________________________________________________________ Mike Ferris Once in a while mferris@trirex.com You can get shown the light Trirex Systems, Inc. In the strangest of places (212) 856-9000 If you look at it right. -RH
Technical Details
Message-ID:
<1992Nov2.171642.3196@Trirex.COM>Path:
arc1-ca.pugleaf.net!sparky!uunet!newshost!rootReferences:
<1992Oct30.032043.15086@cs.wisc.edu>Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!newshost!root From: mferris@trirex.com (Mike Ferris) Subject: Re: Trouble adding printing to Bruce Webster's Scribble Message-ID: <1992Nov2.171642.3196@Trirex.COM> Sender: root@Trirex.COM (Operator) Organization: Trirex Systems Inc. References: <1992Oct30.032043.15086@cs.wisc.edu> Distribution: comp.sys.next.programmer Date: Mon, 2 Nov 1992 17:16:42 GMT Lines: 33