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

specializing CELL-SELECT in sequence dialog items

In article <C9BnB9.D58@news.claremont.edu> Matthew Haines writes:
>I'm trying to specialize the cell-select and cell-deselect methods
>of the sequence-dialog-item.  It seems to me that the following code
>should print the coordinates when a cell is clicked on.  Unfortunately,
>it does not.
>(defclass test-sequence-item (sequence-dialog-item)
>  ())
>(defmethod cell-select ((item test-sequence-item) h &optional v)
>  (call-next-method)
>  (format t "~S,~S~%" h v))
>(defvar w)
>(setq w (make-instance 'window
>          :view-subviews
>          (list
>           (make-instance 'test-sequence-item
>             :table-sequence '(0 1 2 3 4 5)))))

This code does, in fact, work in its specialization of cell-select.
It has no effect when one simply clicks on a cell in the sequence dialog item
because the view-click-event-handler for table dialog items does not call
cell-select, but rather deals directly with the Mac List Manager
through an #_LClick call. (The test-sequence-item above will respond
as desired, for example, if cell-select is called from the Listener.)

To get the coordinates of selected cells reported by a mouse-click in the
sequence-dialog-item, set the dialog-item action to do that:

(defclass test-sequence-item (sequence-dialog-item) ()
     #'(lambda (item) 
         (format *standard-output* "~:{~S,~S  ~}~%"
                 (mapcar #'(lambda (cell) (list (point-h cell) (point-v cell)))
                         (selected-cells item))))))

John Gersh                                      John_Gersh@jhuapl.edu
The Johns Hopkins University Applied Physics Laboratory
Johns Hopkins Rd., Laurel, MD 20723		       (301) 953-5503