CLIM mail archive


bucky keys on cmd-menu items

   Date: Mon, 2 Nov 92 13:18:49 EST
   From: Clinton Hyde <>

   I'd like to use other keys, (shift, control, meta...) on normal
   command-menu items. they seem to get born with :left and :right
   pres-translators; what do I need to do to get a :middle or a
   :shift-left attached to one?

Here is the source for the presentation-to-command translator for
command menu items.  I don't have time to test this, but you should be
able to modify it to add specialized translators for the gesture(s) of
your choice.

(in-package :clim)

(define-presentation-translator command-menu-element-to-command
    (command-menu-element command global-command-table
       ((object event)
	(let* ((menu-item (third object))
	       (type (command-menu-item-type menu-item)))
	  (and (or (eql type ':command)
		   (eql type ':function))
		 (command-name (extract-command-menu-item-value menu-item event))
     :tester-definitive t
     ;; The pointer-documentation uses this, too
       ((object presentation context-type frame event window x y stream)
	(let ((documentation (getf (command-menu-item-options (third object)) :documentation)))
	  (if documentation
	      (write-string documentation stream)
		(find-presentation-translator 'command-menu-element-to-command
		presentation context-type frame event
		window x y stream)))))
    (object event)
  (extract-command-menu-item-value (third object) event))


Main Index | Thread Index