CLIM mail archive

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

Gestures for commands more than 1 arg?



I tried this before, but got no replies.
Lost in the net? Dumb question?  RTFM?
Question made no sense? Nobody knows the answer?

I'll rephrase, just in case.

[CLIM 2.0, Genera 8.3]

I have presentation type, say THING, which has present methods, but I
haven't defined any accept methods (and I otherwise wouldn't need 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 with presentations translating to commands.
I click on a THING, the command w/ arg gets echoed, 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, and the
cursor is at the end, but I get beeped at alot; Trying to type anything
makes clear that the command parser is still trying to read a THING ---
and, of course, it cant.

What I was hoping for (and expecting based on DW .. and I thought CLIM
1.1, too) was that CLIM would `pretend' to parse the first argument ---
it _has_ the object already; why would it want to present it and then
accept it back from the textual representation?   -- and would then
proceed to parsing the 2nd argument (which it can parse because there's
a accept method defined for it).

Is this a bug or misuse?
Do I really have to define an accept method for these types? 
Or is there just some obscure keyword I'm missing?

An example is below, if my description (still) 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*))

Follow-Ups:

Main Index | Thread Index