CLIM mail archive


Detecting (to avoid logging) :ACCEPT-VALUES commands

CLIM 2.0-beta on LispWorks 3.2.21-beta-4
CLIM 2.0 on Allegro 4.2

I want to log the ordinary commands my application executes, but not
any commands directed to the :ACCEPT-VALUES pane.  I am using the
attached code, but it seems a little kludgy, and one vendor is even
using a command table that my application's command table doesn't
inherit from.  (Mine inherits from CLIM:ACCEPT-VALUES-PANE, as the
documentation requires.)  Is there any better way to do this?

        Lawrence G. Mayka
        AT&T Bell Laboratories

Standard disclaimer.

;;; Determine whether a command is actually just an action in the :ACCEPT-VALUES pane
(defun av-command-p (command)
  (let ((command-name (clim:command-name command))
        (av-command-table (clim:find-command-table
                           #+lispworks 'clim:accept-values-pane
                           #+allegro 'clim:accept-values)))
    (clim:command-present-in-command-table-p command-name av-command-table)))

;;; Log each command before executing it
(defmethod clim:execute-frame-command :before ((self my-appl) command)
  (unless (av-command-p command)
    (let ((log (clim:get-frame-pane self 'log)))
      (fresh-line log)
      (write-string "=> " log)
      (clim:present command '(clim:command :command-table my-appl) :stream log))))


Main Index | Thread Index