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

specializing CELL-SELECT in sequence dialog items



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)))))
> 
> 

The problem is that cell-select is defined only for a table-dialog-item 
and not for a sequence-dialog-item.

You can use the hilight-table-cell method to work around this problem.

mark

(defclass test-sequence-item (ccl::sequence-dialog-item)
  ())

(defmethod ccl::highlight-table-cell ((self test-sequence-item) cell rect
selectedp)
  (let ((selected (cell-selected-p self cell)))
    (call-next-method self cell rect selectedp)
    (unless selected (format t "~a~%" (point-string cell)))))

(defvar w)
(defvar v)
(setq v (make-instance 'test-sequence-item 
          :table-dimensions #@(6 1)
          :table-sequence '(0 1 2 3 4 5)))
(setq w (make-instance 'window
          :view-subviews
          (list v)))