CLIM mail archive


Accepting values problem.

    Date: Fri, 30 Oct 1992 19:43 EST
    From: Bill York <>

       Date: Thu, 29 Oct 1992 16:25:42 -0800
       Posted-Date: Thu, 29 Oct 1992 16:25:42 -0800

       Vitals: CLIM 1.1, LUCID 4.0, SUN IPC

       ACCEPTING-VALUES doesn't seem to process gestures that are actions,
       ie., if while filling in a value for an ACCEPT, and an action gesture
       is performed, that action isn't executed.  This works fine if it is a
       plain ACCEPT, but if the ACCEPT is inside the ACCEPTING-VALUES,
       nothing happens.  It works for scrolling the pane which I presume is
       implemented as an action too, right?

    The problem is that your action is defined in the test-comtab command
    table, but when you are running inside accepting-values the active
    command table is accept-values.  I have included a modified version of
    your test application below.  The changes are to add a second action
    translator in the accept-values comtab that checks the value of a
    special variable bound by the command, and to modify the command to
    bind the variable to the frame.  This is pretty kludgy, but it seems
    to work.

    The changes are flagged by the comment "York change"

By the way, in CLIM 2.0, ACCEPTING-VALUES takes a :COMMAND-TABLE
argument that can be used to specify a command table to use for the
extent of the ACCEPTING-VALUES call.  This command table should, of
course, inherit from the (exported) ACCEPT-VALUES command table.

In this example, you would create you own command table that inherits
from ACCEPT-VALUES, make your translator live in the new comtab, and


    (in-package :user)

    (clim:define-application-frame test ()
      ((+current-items+ :initform '(door1 door2 door3)))
      (:panes ((upper :application :scroll-bars nil)
	       (lower :interactor :scroll-bars :both)))
      (:command-table test-comtab)

	 (:column 1 (upper .5) (lower .5))))))

    (clim:define-presentation-action show-option
	(clim:blank-area nil test-comtab :gesture :describe)
      (loop for door in (slot-value clim:*application-frame* '+current-items+)
	    with w = (clim:get-frame-pane clim:*application-frame* 'upper)
	    initially (clim:window-clear w) do
	    (terpri w)
	    (clim:present door 'symbol :stream w)))

    ;;; York change
    (defvar *test-frame* nil)

    (clim:define-presentation-action show-option-aux
	(clim:blank-area nil clim::accept-values :gesture :describe)
      ;; York change
      (when *test-frame*
	(loop for door in (slot-value *test-frame* '+current-items+)
	      with w = (clim:get-frame-pane *test-frame* 'upper)
	      initially (clim:window-clear w) do
	      (terpri w)
	      (clim:present door 'symbol :stream w))))

    (define-test-command (com-exit :name t)
      (clim:frame-exit clim:*application-frame*))

    (define-test-command (com-avs-fails-for-defaction :name t)
      (let ((lower (clim:get-frame-pane clim:*application-frame* 'lower))
	    (upper (clim:get-frame-pane clim:*application-frame* 'upper)))
	(clim:window-clear upper)
	(clim:accept 'symbol :prompt "Click middle in upper to see choices")

	(clim:window-clear upper)
	(terpri lower)
	;; York change
	(let ((*test-frame* clim:*application-frame*))
	    (lower :resynchronize-every-pass t)
	    (clim:accept 'symbol :prompt "Click here, then click middle in upper"
			 :stream lower)))))

    (setq *frame* (clim:make-application-frame 'test :parent
		       (clim:open-root-window :clx :host "sunstruck")
						       :width 500 :height 300))
    (clim:run-frame-top-level *frame*)



Main Index | Thread Index