home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / lisp / mcl / 1986 < prev    next >
Encoding:
Text File  |  1993-01-11  |  4.4 KB  |  105 lines

  1. Path: sparky!uunet!olivea!apple!cambridge.apple.com!jbk@world.std.com
  2. From: jbk@world.std.com (Jeffrey B Kane)
  3. Newsgroups: comp.lang.lisp.mcl
  4. Subject: Re: hopelessly stuck
  5. Message-ID: <199301101903.AA03633@world.std.com>
  6. Date: 10 Jan 93 19:03:30 GMT
  7. Sender: info-mcl-request@cambridge.apple.com
  8. Lines: 94
  9. Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
  10.  
  11.  
  12. I looked at the code.  It looks like this was removed from a larger set of code so I
  13. had to do a few things like remove the dialog-item-action functions from the code.
  14. I also added some definitions to your let statement and changed some other stuff
  15. (all marked with the word "add" below).
  16.  
  17. I'll assume that you were reading in the complete list (left-y, right-x, etc) and just
  18. accidently cut it out when you pasted the code.  The biggest problem that I saw
  19. was that you were defining each dialog item in your list as is it was the bounding
  20. box of the dialog item (in the window's coordinates).  The problem was you were using
  21. it in you code as if it was the view-position followed by the view-size.  Thus all your
  22. dialog items were large and overlapping structures.  Below is some code that seems to 
  23. work just fine (with the dialog-item-actions removed)
  24.  
  25. (defvar *show-list* nil)
  26. (defvar *items* nil)
  27. (defun init-all-items (items &rest rest) ; added "&rest rest"
  28.   (declare (list items))
  29.   (setf *show-list* '())
  30.   (dolist (item items)
  31.     (let ((display-item (first item))
  32.           (left-x (second item))
  33.           (left-y (third item))         ; add all the following to your let statement
  34.           (right-x (fourth item))
  35.           (right-y (fifth item))
  36.           (dialog-text (sixth item))
  37.           (skipping rest)
  38.           (first-radio-btn t)) ; <- Extra ) here? it as removed
  39.       (declare (atom sym left-x left-y right-x right-y)
  40.                (string dialog-text)
  41.                (ignore skipping)) ; <- added
  42.  
  43.       ; changed append to push, just a style difference
  44.       (cond ((equal display-item :radio)
  45.              (push (make-dialog-item 'radio-button-dialog-item
  46.                                       (make-point left-x left-y)
  47.                                       (make-point right-x right-y)
  48.                                       dialog-text
  49.                                       nil
  50.                                       :view-font '("Monaco" 9 :plain)
  51.                                       :radio-button-cluster 3
  52.  
  53.                                       ; added - this just makes sure the first button is checked
  54.                                       :radio-button-pushed-p (if first-radio-btn
  55.                                                                (progn (setf first-radio-btn nil)
  56.                                                                t)
  57.                                                                nil))
  58.              *show-list*))
  59.             ((equal display-item :check)
  60.              (push  (make-dialog-item 'check-box-dialog-item
  61.                                       (make-point left-x left-y)
  62.                                       (make-point right-x right-y)
  63.                                       dialog-text
  64.                                       nil
  65.                                       :view-font '("Monaco" 9 :bold))
  66.                     *show-list*))                                    
  67.             (t nil))))
  68.      
  69.             (make-instance 'window
  70.                   :window-type :document 
  71.                   :window-title "Test Dialog"
  72.                   :view-position #@(20 40)
  73.                   :view-size #@(200 300)
  74.                   :view-subviews *show-list*))
  75.  
  76. ; You are interpreting this as:
  77. ; type, view-position, view-size, text, nickname (?)
  78. ; your view-size was being listed as if it was the other side of the bounding box
  79. ; for the dialog item, thus they all overlapped (that's why you didn't see them all
  80. ; and they appeared funny on the screen                             
  81. (setf *items*
  82.       '((:check 10  80 120 16 "Unemployed" :status-unemployed)
  83.         (:check 10 100 120 16 "Married" :status-married)
  84.         (:radio 10 120 150 12 "Dysarthria" :dysarthric)
  85.         (:radio 10 136 150 12 "Acute Onset" :course-acute)))
  86.  
  87. ;; try it out
  88. (init-all-items *items*)
  89.  
  90.  
  91.          Hope this helps,
  92.              Jeffrey
  93.  
  94.  
  95. ======================================
  96. Jeffrey Kane, MD
  97. Kane Biomedical Systems
  98. Boston, MA
  99.  
  100. Internet    jbk@world.std.com
  101. Compuserve  74206,640
  102. AppleLink   D0738
  103.  
  104. [Don't take life too seriously... it's not like anyone gets out of it alive.]
  105.