Newsgroups: comp.sys.next Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!hellgate.utah.edu!fcom.cc.utah.edu!news From: burchard@math.utah.edu (Paul Burchard) Subject: Re: How to put a dot on the NeXT screen ( ***SHORT*** :-) Message-ID: <1991Jun5.055531.6189@fcom.cc.utah.edu> Sender: news@fcom.cc.utah.edu Organization: University of Utah Computer Center References: <1991Jun4.134204.28921@casbah.acns.nwu.edu> Date: Wed, 5 Jun 91 05:55:31 GMT In article <1991Jun4.134204.28921@casbah.acns.nwu.edu> jimmyc@casbah.acns.nwu.edu (James Choi) writes: > > I am having trouble putting a dot on the NeXT screen. Could someone show > me how to do it with a compilable sample source code? I give here *complete* directions---you will write < 10 lines of code! Start Interface Builder, select New Application from the menu. Get the Inspector panel from the Tools menu, first switching it to Project mode and clicking OK to create a project file (these will go in your home dir for now...sorry). Next switch the Inspector to Class mode. In the class browser window, select the View class (under Responder), Subclass it, and then Unparse the new class to generate code templates. Go back to the Project Files Inspector, find MyView.[hm], and click the Open button. The two files pop up for editing. In MyView.h, add the line - drawSelf:(const NXRect *)rects :(int)rectCount; just before the @end. Saving that, add this to MyView.m just before the @end: #import -drawSelf:(const NXRect *)rects :(int)rectCount { PSsetgray(0.); PSnewpath(); PSmoveto(10.,10.); PSlineto(10.,10.); PSstroke(); return self; } Save this file too. From the IB Palettes, drag-and-drop a CustomView into the "MyWindow" window (use the resize knobs to make the View fill the Window). In the Attributes Inspector, choose its class to be "MyView" from the scrolling list. Save As into "myapp.nib". Select ".nib" in the Project Files inspector and click Add; double-click on myapp.nib in the pop-up browser to incorporate it. Finally, choose Save All, and then Make, from the IB menu. You will now have an Application in your home dir called myapp.debug. Launch it. Enjoy your "one point of light" :-) ----------------------------------------------------------------------------- Paul Burchard ``I'm still learning how to count backwards from infinity...'' -----------------------------------------------------------------------------