[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Basic color use in MCL

 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.


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.]