CLIM mail archive

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

Presentation menu questions.



    Date: Wed, 15 Sep 1993 10:29 PDT
    From: Scott McKay <SWM@STONY-BROOK.SCRC.Symbolics.COM>

	Date: Wed, 15 Sep 1993 11:41 EDT
	From: Gregory M Anderson <gma@bitterroot.apl.washington.edu>

	I'm having two problems with the printed output of items displayed 
	in the :menu mouse gesture menu.

	1) When I define a translator that passes multiple objects, i.e.

	  (define-presentation-to-command-translator foo-tran
	      (my-type foo my-frame)
	    (object frame)
	    `(,object ,frame))

	  (define-sectors-frame-command (foo
		:menu "Print this in the menu.")
	      ((object 'my-type) (frame 'my-frame))
	   (do-something))

    Could you make a small failing application for me?  The apps I have all
    do exactly what I expect.

	  The menu comes up with an corresponding printed representation
	   "Print this in the menu #<PACKAGE::FRAME 123456789>"

	  CLIM seems to want to display a printed representation of the 
	  arguments.  I want to suppress it.

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
SAMPLE CODE 

Note: these two examples are slightly different, and in seperate packages.

;;; -*- Mode: LISP; Syntax: Common-lisp; Package: (menu-test2 :use (clim clim-lisp)) ; Base: 10 -*-
;;; Genera 8.3 CLIM 2.0

(defclass Foo ()
    ())

(defvar *test-frame* nil)

(define-application-frame test-frame ()	   
    ()
  (:command-table (test-frame :inherit-from (accept-values-pane)))
  (:panes
    (nav         :application
		 :display-function 'draw-foos-display
		 )
    (pointer     :pointer-documentation)
    (menu     :command-menu)
    (inter    :interactor))

  (:layouts
    (default
      (vertically ()
	(:fill nav)
	(.2 inter)
	(.04 pointer))))
  )

;;;;;;;;;;;;;;;;;; RUN THIS FUNCTION

(defun menu-test (&key (port (find-port)))
  (let*
    ((framem (find-frame-manager :port port))
     (frame (make-application-frame 'test-frame
	      :pretty-name "Test Frame"
	      :frame-manager framem
	      :height 800
	      :width 500)
	    ))
    (setf *test-frame* frame)
    (run-frame-top-level frame)))

(define-test-frame-command (com-exit-sectors-frame
			     :menu "Exit")
    ()
  (frame-exit *test-frame*)
  )

(defmethod draw-foos-display ((frame test-frame) stream)
  (present (make-instance 'foo) 'foo :stream stream)
  )

(define-presentation-method present 
			    (foo (type Foo) stream
				   (view textual-menu-view)
				   &key)
  (format stream "~A" foo))

(define-test-frame-command (foo-action
			     :name "Foo action for 2 args"
)
    ((object 'foo) (frame 'test-frame))
  )

(define-presentation-to-command-translator foo-tran
    (foo foo-action test-frame
	 :pointer-documentation "Foo with 2 args"
	 )
    (object frame)
  `(,object ,frame))

(define-test-frame-command (foo-action2
			     :name "Foo action for no args"
			     )
    ()
  )

(define-presentation-to-command-translator foo-tran2
    (foo foo-action2 test-frame
	 :pointer-documentation "Foo with no args"
	 :gesture :describe
	 )
    (object)
    ())


^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^	


	2) In some cases I want to delete the :menu mouse action altogether,
	   but defining a
		(define-presentation-to-command-translator foo
		    (my-type command frame :menu nil)
	   seems to be determined to add the :menu gesture to the mouse, although
	   it does remove the item from the menu.  So what I end up with is a
	   :menu gesture documented in the mouse line, and an empty menu.
	   Probably confusing to the end user, wouldn't you think?

    In the CLIM I am running, I don't get the menu translator offered unless
    there is something in the menu.

I don't get the menu, but I do get mouse line documentation on the gesture.

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
SAMPLE CODE 

Note: these two examples are slightly different, and in seperate packages.

;;; -*- Mode: LISP; Syntax: Common-lisp; Package: (menu-test :use (clim clim-lisp)) ; Base: 10 -*-
;;; Genera 8.3 CLIM 2.0

(defclass Foo ()
    ())

(defvar *test-frame* nil)

(define-application-frame test-frame ()	   
    ()
  (:command-table (test-frame :inherit-from (accept-values-pane)))
  (:panes
    (nav         :application
		 :display-function 'draw-foos-display
		 )
    (pointer     :pointer-documentation)
    (menu     :command-menu)
    (inter    :interactor))

  (:layouts
    (default
      (vertically ()
	(:fill nav)
	(.2 inter)
	(.04 pointer))))
  )

(defun menu-test (&key (port (find-port)))
  (let*
    ((framem (find-frame-manager :port port))
     (frame (make-application-frame 'test-frame
	      :pretty-name "Test Frame"
	      :frame-manager framem
	      :height 800
	      :width 500)
	    ))
    (setf *test-frame* frame)
    (run-frame-top-level frame)))

(define-test-frame-command (com-exit-sectors-frame
			     :menu "Exit")
    ()
  (frame-exit *test-frame*)
  )

(defmethod draw-foos-display ((frame test-frame) stream)
  (present (make-instance 'foo) 'foo :stream stream)
  )

(define-presentation-method present 
			    (foo (type Foo) stream
				   (view textual-menu-view)
				   &key)
  (format stream "~A" foo))

(define-test-frame-command (foo-action
			     :menu nil)
    ((object 'foo) (frame 'test-frame))
  )

(define-presentation-to-command-translator foo-tran
    (foo foo-action test-frame
	 :pointer-documentation "Foo test"
;;;;;;;;;;;;;;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
	 :menu nil				;THIS DELETES THE ITEM FROM THE MENU
						;BUT MENU STILL APPEARS IN THE MOUSE
						;LINE DOCUMENTATION
;;;;;;;;;;;;;;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
	 )
    (object frame)
  `(,object ,frame))


^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^	


Follow-Ups: References:

Main Index | Thread Index