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

mcl interface question



Dear LISPers,

I have two questions.  Given the two test windows defined below...

	1.  How can I call for an update of one window using a button
	on another window? That is, I want to implement the commands
	with the ??? arguments below (one in each window)  but don't
	know what argument can be used.  (Kluge's accepted gratefully as I
	have much code in this form...)

	2.  The UPDATE of each window puts the value of the editable-
	dialog box in lower case as called for. But when the window is 
	originally created, the value appears in upper case.  How do I tell
	'initialize-instance' to read the value in lower case? 

Except for the usual line-break prob's the following code should run,
albeit with the prob's above.

Thanks in advance for any help offered.

David Evan Jones
Music Department
University of California Santa Cruz

******

(defvar *a-button-UPDATE* ())
(defvar *an-other-button-UPDATE* ())
(defvar *test-diagram* 'n)
(defvar *test-diagram-nick* 'n)
(defvar *other-test-diagram* 'm)
(defvar *other-test-diagram-nick* 'm)

(defun update-test-window (item)
    (set-dialog-item-text (find-named-sibling item
'*test-diagram-nick*)(write-to-string *test-diagram*)))

(defun update-other-test-window (item)
    (set-dialog-item-text (find-named-sibling item
'*other-test-diagram-nick*)(write-to-string *other-test-diagram*)))


(defclass my-TEST-window (window)
  ((variable-1 :initarg :variable-1
               :initform nil
               :accessor variable-1))
  (:default-initargs :window-type :document
    :window-title "TEST"
    :view-position #@(250 40)
    :view-size #@(180 50)))


(defmethod initialize-instance ((window my-TEST-window) &rest
initargs)
  (apply #'call-next-method window initargs)
  
  (add-subviews window 
                (setq *a-button-UPDATE* (make-dialog-item 
                                            'button-dialog-item
                                            #@(10 10) #@(80 25)
                                            "UPDATE"
                                            #'(lambda (item) 
                                                item 
                                                (progn 
                                                  (update-test-window item)
						 ;(update-other-test-window ???)
))))
                (make-instance 'editable-text-dialog-item
                  :view-position #@(120 10)
                  :view-font '("Zapf Dingbats" 12)
                  :view-nick-name '*test-diagram-nick*
                  :view-size #@(20 14) 
	          :dialog-item-text (write-to-string *test-diagram* 
				:case :downcase)
                  :dialog-item-action
                  #'(lambda (item)
                      (setq *test-diagram-nick* (setq *test-diagram*
			(read-from-string (let ((thi (dialog-item-text item)))

  		(if (string= thi "") "()" thi))))))))
                
	(set-part-color *a-button-UPDATE* :body *red-color*)
        (set-part-color *a-button-UPDATE* :text *white-color*))


(defclass my-other-TEST-window (window)
  ((variable-1 :initarg :variable-1
               :initform nil
               :accessor variable-1))
  (:default-initargs :window-type :document
    :window-title "OTHER TEST"
    :view-position #@(40 40)
    :view-size #@(180 50)))


(defmethod initialize-instance ((window my-other-TEST-window) &rest
initargs)
  (apply #'call-next-method window initargs)
  
  (add-subviews window 
                (setq *an-other-button-UPDATE* (make-dialog-item 
                                                'button-dialog-item
                                                #@(10 10) #@(80 25)
                                                "UPDATE"
                                                #'(lambda (item) 
                                                    item 
                                                    (progn 
					(update-other-test-window item)
					;(update-test-window ???)
                                                      ))))
                (make-instance 'editable-text-dialog-item
                  :view-position #@(120 10)
                  :view-font '("Zapf Dingbats" 12)
                  :view-nick-name '*other-test-diagram-nick*
                  :view-size #@(20 14) 
	          :dialog-item-text (write-to-string *other-test-diagram* 
				:case :downcase)
                  :dialog-item-action
                  #'(lambda (item) 
                      (setq *other-test-diagram-nick* (setq *other-test-diagram*
			(read-from-string (let ((thi (dialog-item-text item)))
  			(if (string= thi "") "()" thi))))))))
                
	(set-part-color *an-other-button-UPDATE* :body *red-color*)
        (set-part-color *an-other-button-UPDATE* :text *white-color*))


(make-instance 'my-test-window)
(make-instance 'my-other-test-window)