home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!ames!data.nas.nasa.gov!taligent!apple!cambridge.apple.com!jbk@world.std.com
- From: jbk@world.std.com (Jeffrey B Kane)
- Newsgroups: comp.lang.lisp.mcl
- Subject: Re: Basic color use in MCL
- Message-ID: <199211231817.AA09150@world.std.com>
- Date: 23 Nov 92 18:17:32 GMT
- Sender: info-mcl-request@cambridge.apple.com
- Lines: 52
- Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
-
- Bill,
- A couple of mistakes:
-
- (defclass TWindow (window)
- nil) ; a dull class
-
- (defvar temp (make-instance 'TWindow :window-title "Dull Window"))
-
- (defmethod view-draw-contents ((self TWindow))
- (with-fore-color *red-color*
- (with-pstrs ((str "hello"))
- (move-to self 40 40) ; default pen position is 0,0 so you won't see anything
- (#_DrawString str))
- (move-to self 40 80)Hello againHello again
- (format self "Hello again")))
-
- (with-focused-view temp
- (view-draw-contents temp))
-
-
- Note that MCL will focus the view for you before it calls your
- view-draw-contents. You only need to focus it again if you call
- view-draw-contents on another view that's not in the normal drawing
- event chain.
-
- Since you are defining a primary method you -- may -- want to call
- (call-next-method) so you don't shadow the default draw method for
- that view. I usually define an :after method for most drawing routines.
-
- Last of all the problem you may be having is that you didn't move the
- pen to a visible part of the view. The default is 0,0 which puts the
- text up out of the content area of the window.
-
- The only other item of note is that you can use Lisp's format statement
- to draw into windows since they are streams in Lisp. This can make
- formating a lot easier for a lot of applications.
-
- Jeffrey
-
- P.S. How's U-of-M? I haven't been back their for years (Chem Eng Terp '79)
-
-
- ======================================
- Jeffrey Kane, MD
- Kane Biomedical Systems
- Boston, MA
-
- Internet jbk@world.std.com
- Compuserve 74206,640
- AppleLink D0738
-
- [Don't take life too seriously... it's not like anyone gets out of it alive.]
-