[comp.sys.next] CustomView and PostScript

scott@sage.uchicago.edu (Scott Deerwester) (09/15/90)

I'm trying to write a very simple little application that has a custom
view in it that displays some PostScript.  I've threaded the thing
together with the IB, and the drawSelf method for the view is getting
executed, but nothing happens in the window.  Here's some of the code
for the CustomView:

-drawWindow:sender
{
	[self display];
	return (self);
}

-drawSelf:(NXRect *)r:(int)count
{
	putchar ('\007');
	fflush (stdout);

	PSsetgray (11.0 / 12.0);

	PSrectfill (bounds.origin.x, bounds.origin.y,
		    bounds.size.width, bounds.size.height);

	...

	return (self);
}

I hookup up a menu item to the drawWindow method, and every time I
push the button, I hear the beep (putchar ('\007')) but nothing
changes in the window.  Am I missing something somewhere?
--
Scott Deerwester            | Internet: scott@tira.uchicago.edu  | ~{P;N,5B~}
Center for Information and  | Phone:    312-702-6948             |
   Language Studies         | 1100 E. 57th, CILS                 |
University of Chicago       | Chicago, IL 60637                  |

absinthe@milton.u.washington.edu (Daniel Faken) (09/16/90)

shouldnt you do a [myView lockFocus] before you start drawing?
(and a [myView unlockFocus] after you're finished)

a PSflushgraphics might also help..
-- 
-----------------------------------------------------------------------------
absinthe@milton.u.washington.edu     |    "Don't get Odd, get Even"

rca@cs.brown.edu (Ronald C.F. Antony) (09/17/90)

Did you #import <dpsclient/wraps.h> ?
Without that you don't get any errors, but things are painted that
small in your view that you can't see them. At least that was what
happened once to me...

Ronald
------------------------------------------------------------------------------
"The reasonable man adapts himself to the world; the unreasonable one persists
in trying to adapt the world to himself. Therefore all progress depends on the
unreasonable man."  Bernhard Shaw | rca@cs.brown.edu or antony@browncog.bitnet

moose@svc.portal.com (09/17/90)

In article <7634@milton.u.washington.edu> absinthe@milton.u.washington.edu (Daniel Faken) writes:
>shouldnt you do a [myView lockFocus] before you start drawing?
>(and a [myView unlockFocus] after you're finished)

No he should not.  It is done for him in the display method.  
-- 
Michael Rutman				|	moose@svc.portal.com
Cubist					|	makes me a NeXT programmer
Software Ventures			|	That's in Berkeley
smile, you're on standard disclaimer	|	<fill in with cute saying>