CLIM mail archive

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

Re: a display goodie...




  Date: Tue, 24 May 94  18:40:37 EDT
  From: chyde@labs-n.bbn.com

  #+ACL 4.2
  #+clim-2.0

  here's something I fixed up just recently that's QUITE useful. ever
  notice that an app-pane pointer is almost indecipherable? this should
  fix that...

  where you used to get

  #<application-pane @ x54839257>

  you can now get

  #<application-pane YOUR-PANE-NAME>

  !! now your error messages will tell you exactly which pane had a
  problem !!

   -- clint

  someone who knows more clim details than I should look at this and see
  whether or not I've guessed correctly about the hierarchy of panes...

A simpler and more robust thing to do would be to walk up the sheet
hierarchy using SHEET-PARENT looking for the first sheet for which
PANE-NAME returns non-nil. 

You might also want to look at using PRINT-UNREADABLE-OBJECT in your print
method eg

(defmethod print-object ((color rgb-color) stream)
  (print-unreadable-object (color stream :type t :identity t)
    (with-slots (red green blue) color
      (format stream "R=~F G=~F B=~F" red green blue))))

-----
Colin Meldrum, Franz Inc.	1995 University Avenue, Suite 275         
colin@Franz.COM (internet)	Berkeley, CA 94704                       
uunet!franz!colin (uucp)	Phone: (510) 548-3600; FAX: (510) 548-8253


  ;;;here's something really cool, which makes error-messages considerably more valuable.
  ;;;it's probably pretty fragile, tho...

  (defmethod print-object ((myself clim::application-pane) stream)
    (princ " #<APPLICATION-PANE " stream)
    (dolist (top-pane (slot-value (slot-value myself 'clim-silica::frame)
				  'clim-internals::all-panes))
      (when (eq myself (get-app-pane (cadr top-pane)))
	(prin1 (car top-pane)
	       stream)
	(return)))
    (princ "> " stream))

  ;;;this will lose if it never gets an actual app-pane. I don't know the cutoff point.

  (defun get-app-pane (thing)
    (when (null thing) (return-from get-app-pane 'OOPS))
    (if (typep thing 'application-pane)
	thing
      (get-app-pane (cadr (member :contents 
				  (slot-value
				   thing 
				   'clim-silica::initargs)))
		    )
      ))

References:

Main Index | Thread Index