[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: hopelessly stuck
- To: info-mcl@cambridge.apple.com
- Subject: Re: hopelessly stuck
- From: jbk@world.std.com (Jeffrey B Kane)
- Date: Sun, 10 Jan 1993 14:03:30 -0500
I looked at the code. It looks like this was removed from a larger set of code so I
had to do a few things like remove the dialog-item-action functions from the code.
I also added some definitions to your let statement and changed some other stuff
(all marked with the word "add" below).
I'll assume that you were reading in the complete list (left-y, right-x, etc) and just
accidently cut it out when you pasted the code. The biggest problem that I saw
was that you were defining each dialog item in your list as is it was the bounding
box of the dialog item (in the window's coordinates). The problem was you were using
it in you code as if it was the view-position followed by the view-size. Thus all your
dialog items were large and overlapping structures. Below is some code that seems to
work just fine (with the dialog-item-actions removed)
(defvar *show-list* nil)
(defvar *items* nil)
(defun init-all-items (items &rest rest) ; added "&rest rest"
(declare (list items))
(setf *show-list* '())
(dolist (item items)
(let ((display-item (first item))
(left-x (second item))
(left-y (third item)) ; add all the following to your let statement
(right-x (fourth item))
(right-y (fifth item))
(dialog-text (sixth item))
(skipping rest)
(first-radio-btn t)) ; <- Extra ) here? it as removed
(declare (atom sym left-x left-y right-x right-y)
(string dialog-text)
(ignore skipping)) ; <- added
; changed append to push, just a style difference
(cond ((equal display-item :radio)
(push (make-dialog-item 'radio-button-dialog-item
(make-point left-x left-y)
(make-point right-x right-y)
dialog-text
nil
:view-font '("Monaco" 9 :plain)
:radio-button-cluster 3
; added - this just makes sure the first button is checked
:radio-button-pushed-p (if first-radio-btn
(progn (setf first-radio-btn nil)
t)
nil))
*show-list*))
((equal display-item :check)
(push (make-dialog-item 'check-box-dialog-item
(make-point left-x left-y)
(make-point right-x right-y)
dialog-text
nil
:view-font '("Monaco" 9 :bold))
*show-list*))
(t nil))))
(make-instance 'window
:window-type :document
:window-title "Test Dialog"
:view-position #@(20 40)
:view-size #@(200 300)
:view-subviews *show-list*))
; You are interpreting this as:
; type, view-position, view-size, text, nickname (?)
; your view-size was being listed as if it was the other side of the bounding box
; for the dialog item, thus they all overlapped (that's why you didn't see them all
; and they appeared funny on the screen
(setf *items*
'((:check 10 80 120 16 "Unemployed" :status-unemployed)
(:check 10 100 120 16 "Married" :status-married)
(:radio 10 120 150 12 "Dysarthria" :dysarthric)
(:radio 10 136 150 12 "Acute Onset" :course-acute)))
;; try it out
(init-all-items *items*)
Hope this helps,
Jeffrey
======================================
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.]