[mcclim-devel] menu items, command arguments and read-frame-command

Robert Goldman rpgoldman at real-time.com
Fri Mar 2 15:58:42 UTC 2007


I have a command in my McCLIM application that allows the user to set
pathname defaults:

(define-taems-mdp-app-command (com-change-taems-filename-defaults :name t)
    ((pathname 'directory-pathname
	       :default (make-pathname :directory (pathname-directory
(taems-pathname-defaults *application-frame*)))
               :prompt "New default TAEMS model directory?"))
...)

You will see that it takes one argument.

I have put it in the file menu of my application, and when I try to
invoke it, McCLIM crashes with the following error:

Error: KAUAI-GRAPHER::COM-CHANGE-TAEMS-FILENAME-DEFAULTS got 0 args,
wanted 1 arg.
  [condition type: PROGRAM-ERROR]

Restart actions (select using :continue):
 0: Return to application command loop
 1: Abort entirely from this (lisp) process.
[Current process: TAEMS CLIM Grapher]
[1] CL-USER(1): :bt
Evaluation stack:

GRAPH-MDP::COM-CHANGE-TAEMS-FILENAME-DEFAULTS <-
  (METHOD CLIM:EXECUTE-FRAME-COMMAND (CLIM:APPLICATION-FRAME T)) <-
  (METHOD CLIM:DEFAULT-FRAME-TOP-LEVEL (CLIM:APPLICATION-FRAME)) <-
(:INTERNAL (:EFFECTIVE-METHOD 1 T ...) 0) <-
  (:INTERNAL (MOP:CLASS-DEFAULT-INITARGS GRAPH-MDP::TAEMS-MDP-APP
:TOP-LEVEL-LAMBDA) 0) <-
  (METHOD CLIM:RUN-FRAME-TOP-LEVEL (CLIM:APPLICATION-FRAME)) <- (METHOD
CLIM:RUN-FRAME-TOP-LEVEL :AROUND ...) <-
  (:INTERNAL (:EFFECTIVE-METHOD 1 T ...) 0) <- (:INTERNAL
GRAPH-MDP:RUN-GRAPHER 0)

My understanding from reading the manual is that when I invoke this
command from the menu, it should prompt me to accept the arguments.

add-menu-item-to-command-table
               [Function]
Arguments:     command-table string type value &key documentation (after
               :end) keystroke text-style (errorp t) button-type
    s Adds a command menu item to command-table's menu. The arguments are:
    command-table
      Can be either a command table or a symbol that names a command table.
    string
      The name of the command menu item. The character case and style of
string are ignored. This
      is how the item will appear in the menu.
    type
      This is one of: :command, :menu, or :divider. (:function, called
for in the CLIM spec,
      is not supported in this release.) When type is :command, value
should be a command (a cons
      of a command name followed by a list of the command's arguments),
or a command name. (When
      value is a command name, it behaves as though a command with no
arguments was supplied.)
      In the case where all of the command's required arguments are
supplied, clicking a command
      menu item invokes the command immediately. Otherwise, the user
will be prompted for the
      remaining required arguments.

[from the Allegro CLIM manual; the online spec has similar wording.]

Can anyone say why McCLIM is crashing here?  It seems like the
read-frame-command :around method should have invoked
command-line-remaining-arguments-for-partial-command.  The code is here:

(defmethod read-frame-command :around ((frame application-frame)
				       &key (stream *standard-input*))
  (with-input-context ('menu-item)
      (object)
      (call-next-method)
    (menu-item
     (let ((command (command-menu-item-value object)))
       (unless (listp command)
	 (setq command (list command)))
       (if (and (typep stream 'interactor-pane)
		(member *unsupplied-argument-marker* command :test #'eq))
	   (command-line-read-remaining-arguments-for-partial-command
	    (frame-command-table frame) stream command 0)
	   command)))))

Is it possible that the stream is not an interactor-pane when the menu
item is selected?

For other commands, I have kludged around this problem and made them
take no arguments and just accept them "by hand," as it were...

Any help would be much appreciated.

thanks,
R





More information about the mcclim-devel mailing list