CLIM mail archive


compound presentation-to-command-translator question

Is there a way to create a presentation-to-command-translator with a compound
presentation type (something like OR) where both types are derived from the
same superclass?  It seems if both types are derived from the same superclass
you're screwed?  Below illustrates my point!

Suppose you wish to take two types that come from the same
superclass and use the same mouse gesture on both of them to invoke the same


(defclass a () ())
(defclass b (a) ())
(defclass c (a) ())
(defclass d (a) ())  ;just here to indicate that there are other subclasses
		     ;that won't use the command

Now you define your application command to handle either class.

(define-command (com-do-something :name t :command-table a-command-table) 
	((b-or-c '(or b c))

Now I wish to invoke the same command from only types b and c.
Too bad you can't do it this way ---|
				   \ /

(define-presentation-to-command-translator do-something
	((or b c) com-do-something a-command-table :gesture :select)
	(object) (list object))

so, I do it this way ...

(define-presentation-to-command-translator do-something
	(b com-do-something a-command-table :gesture :select)
	(object) (list object))

(define-presentation-to-command-translator do-something
	(c com-do-something a-command-table :gesture :select)
	(object) (list object))

BUT, when I mouse on either type only C types are highlighted and able to
invoke the do-something command. B types for some reason don't get the
translator ... WHY?  The order of the last two forms influences who can
do the command but why is that?  How can I get around this?  Or do I have
to fake it by doing something like

(defclass b-or-c (b c) ())

then do a translator for this turkey.  Seems like excess overhead if so!

Main Index | Thread Index