CLIM mail archive

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

Strange (to me) behavior with define-command




I just ran into something a little odd today.  Consider the following example
(assuming the appropriate supporting code):

(defclass A ()
    ((slot-1 ...)
     (slot-2 ...))
  )

(defclass B (A)
    ((slot-3 ...))
  )

(clim:define-presentation-type A ())
(clim:define-presentation-type B ()
   :inherit-from 'A)

(clim:define-command (edit-A :command-table edit)
    ((Aobj 'A
           :gesture :edit))
  ...)

(clim:define-command (edit-B :command-table edit)
    ((Bobj 'B
           :gesture :edit))
  ...)

If an instance of class B is presented, then which command is accessible by
the :edit gesture depends on the order that the commands are defined.  If
edit-A is defined first, then edit-B is never accessible.  If edit-B is
defined first, then everything is OK.  

It doesn't explicitly say so in the documentation, but I would (and did)
assume that the translator for the most specific presentation type would be
accessible before any others.  I can always explicitly define the translators
manually with the right priority values, or use a tester for edit-A to make
sure that the objects are not B's, but I think this should be handled
automatically.  Comments?

Thanks,
Randy

-- 
Randy A. Coulman                |       ARIES Laboratory
                                |       Department of Computational Science
coulman@cs.Usask.ca             |       University of Saskatchewan
                                |       Saskatoon, SK   S7N 0W0             


Follow-Ups:

Main Index | Thread Index