CLIM mail archive

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

Gestures for commands more than 1 arg?



[CLIM 2.0, Genera 8.3]

I have presentation type, say THING, which has present methods, but no
accept methods defined for them.

When I define a command w/ 1 arg, eg.

  (define-bugtest-command (com-test1 :name t)((thing 'thing :gesture :select)) 
	...)
there's no problem. I can click on a THING and the command gets invoked.

But if I define a command with more args, eg.

  (define-bugtest-command (com-test2 :name t)((thing 'thing :gesture :describe)(number 'number))
     ...)
If I click on a THING, the command w/ 1st arg gets echoed, but I get
beeped at alot; it appears as if the command parser is trying to
parse the text of the THING it was given (unlike the 1 arg case).

What I was expecting (hoping for) was that it would know it already
had the 1st arg, and should skip onto the second. 
DW works this way (at least with :activate nil, or whatever).  I thought
this worked in CLIM 1.1, too, but I could be wrong.

Is this a bug or misuse?
Do I have to define an accept method for these types? (ugh) 
That would mean that the THING gets translated into a command which then
parses the text of the presentation of THING in order to get back to
THING?  Naah, cant be.

Or is there just some obscure keyword I'm missing?

An example is below, if my description isn't clear enough.

  bruce
  miller@cam.nist.gov
  
;;; -*- Mode: LISP; Syntax: Common-lisp; Package: clim-USER; Base: 10 -*-

(define-application-frame bugtest ()
    ()
  (:menu-bar nil)
  (:panes
    (display :application)
   (interactor :interactor :height '(10 :character)))
  (:layouts
    (default 
      (vertically () display interactor))))

(defmethod frame-standard-output ((bugtest bugtest))
  (get-frame-pane bugtest 'interactor))

(defun run-bugtest ()
  (run-frame-top-level (make-application-frame 'bugtest
			 :frame-manager (find-frame-manager :port (find-port)))))

;;; Thing is  a presentation type with no parser defined.
(define-presentation-type thing ())

(define-presentation-method present (thing (type thing) stream (view textual-view) &key)
  (princ thing stream))

;;; Run this command to get some `thing's to act upon.
(define-bugtest-command (com-setup :name t)()
  (let ((stream (get-frame-pane *application-frame* 'display)))
    (loop for thing in '(thing1 thing2 thing3) do
      (present thing 'thing :stream stream)
      (terpri stream))))

;;; Click left on a thing:  this works.
(define-bugtest-command (com-test1 :name t)((thing 'thing :gesture :select))
  (print thing))

;;; Click middle on a thing: this command needs a 2nd argument.
;;; Why cant we type it in?  Apparently the command parser insists on
;;; parsing the text of the clicked-on thing.
(define-bugtest-command (com-test2 :name t)((thing 'thing :gesture :describe)(number 'number))
  (declare (ignore number))
  (print thing))

;;; Try the same thing with an explicit translator.  Same result.
(define-bugtest-command (com-test3 :name t)((thing 'thing)(number 'number))
  (declare (ignore number))
  (print thing))

(define-presentation-to-command-translator tester-action
    (thing com-test3 bugtest :gesture :edit)
  (object)
  `(,object ,*unsupplied-argument-marker*))


Main Index | Thread Index