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

Robert Goldman rpgoldman at real-time.com
Fri Mar 2 21:56:52 UTC 2007


Robert Goldman wrote:
> A quick follow-up:  this problem only occurs when I invoke my command
> from the menu-bar (i.e., from a submenu in the "File" menu on the
> menubar).  When I invoke the command by using the menu I get with the
> right-button on the application window, McCLIM prompts for commands
> properly.
> 
> So have I misunderstood how to use the menu bar?  Or is this a bug?
> 
> Many thanks,
> Robert
> _______________________________________________
> mcclim-devel mailing list
> mcclim-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/mcclim-devel
> 

OK, I think that this is a real bug.  The problem is that when you
select a command from a menu item, if it's a command that takes
arguments, and you haven't provided values for them, McCLIM reads the
command as (<command-name>) and pukes on the missing argument(s).

The problem is that it *should* be reading such a command as:

(<command-name> <unsupplied-argument-marker>^n)

for n being the number of arguments to the command.

I have a patch that will make this happen properly:

Index: frames.lisp
===================================================================
RCS file: /project/mcclim/cvsroot/mcclim/frames.lisp,v
retrieving revision 1.125
diff -b -u -F^(def -r1.125 frames.lisp
--- frames.lisp 7 Feb 2007 12:44:16 -0000       1.125
+++ frames.lisp 2 Mar 2007 21:52:13 -0000
@@ -505,9 +505,9 @@ (defmethod read-frame-command :around ((
     (menu-item
      (let ((command (command-menu-item-value object)))
        (unless (listp command)
-        (setq command (list command)))
+        (setq command (partial-command-from-name command)))
        (if (and (typep stream 'interactor-pane)
-               (member *unsupplied-argument-marker* command :test #'eq))
+               (partial-command-p command))
           (command-line-read-remaining-arguments-for-partial-command
            (frame-command-table frame) stream command 0)
           command)))))

I will also attach it for fear mailers that word-wrap will garble it...

Any feedback would be welcome.  This works for me, but isn't even what
I'd laughingly call "tested."

R
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: menu-command-args-patch
URL: <https://mailman.common-lisp.net/pipermail/mcclim-devel/attachments/20070302/5a253146/attachment.ksh>


More information about the mcclim-devel mailing list