Subject: dynamic menus

From: Michael Han <[email-masked]>
Date: Sun, 09 Apr 2000 11:29:48 -0700

Hi all, I'm fiddling with dynamic menus again. I play with them on and
off, but at this point, I'm fairly certain that something funny's
happening. The current version that I'm working with is at

http://www.best.com/~mikehan/PerlMenu

The output it yields looks like this:

AddToMenu /home/mikehan MissingSubmenuFunction MakeMissingMenu
AddToMenu /home/mikehan DynamicPopdownAction DestroyMenu recreate /home/mikehan
AddToMenu /home/mikehan 1 Popup /home/mikehan/1
AddToMenu /home/mikehan 107 Popup /home/mikehan/107
AddToMenu /home/mikehan 120 Popup /home/mikehan/120
AddToMenu /home/mikehan 134 Popup /home/mikehan/134
...

Note that I defined:

AddToMenu /home/mikehan DynamicPopupAction PipeRead PerlMenu /home/mikehan
AddToFunc MakeMissingMenu I PipeRead PerlMenu $0

When I try to popup a submenu of /home/mikehan, such as
/home/mikehan/1, I get a bunch of errors:

[FVWM][add_item_to_menu]: <<ERROR>> menu /home/mikehan is in use

and no submenu ever pops up.

I'm confused. Can anyone out there who knows about the dynamic menu
stuff tell me if I'm doing something that's obviously wrong? Output
from PerlMenu when invoked for a submenu looks like this:

AddToMenu /home/mikehan/1 MissingSubmenuFunction MakeMissingMenu
AddToMenu /home/mikehan/1 DynamicPopdownAction DestroyMenu recreate
/home/mikehan/1
AddToMenu /home/mikehan/1 /home/mikehan/1 Nop

If I add a "Beep" to the head of the output, when I navigate onto the
item with a submenu I get a bunch of beeps, so I know that FVWM is
correctly executing the missing submenu function. The only thing I can
think of right now is that somehow FVWM is trying to addtomenu to
/home/mikehan instead of /home/mikehan/1.

So, any thoughts?

By the way, while trying to figure this out, I discovered that the
manpage is wrong. The manpage says that the token for missing submenu
creation is "MissingSubmenuFunc" but the code really works with
"MissingSubmenuFunction". I have a manpage patch attached, though
perhaps the manpage is "right" and the code is wrong?
-- 
[email-masked]                         http://www.best.com/~mikehan/
coffee achiever                              San Francisco, California
"Closed Mondays." The Walker Art Center

diff -u -r1.280 fvwm2.1
--- fvwm2.1     2000/03/27 20:50:39     1.280
+++ fvwm2.1     2000/04/09 17:10:19
@@ -1085,7 +1085,7 @@
   do echo AddToMenu JpgMenu "`basename $i`" Exec xv $i; done'
 .EE
 The keyword
-.I MissingSubmenuFunc
+.I MissingSubmenuFunction
 has a similar meaning.  It is executed whenever you try to pop up a
 sub-menu that does not exist.  With this function you can define and
 destroy menus on the fly.  You can use any command after the key
@@ -2237,7 +2237,7 @@
 option affects the
 .I DynamicPopupAction
 and
-.I MissingSubmenuFunc
+.I MissingSubmenuFunction
 options of the
 .B AddToMenu
 command.  If this option is set to "False", then the busy cursor is

---

From: Mikhael Goikhman <[email-masked]>
Date: Mon, 10 Apr 2000 00:45:56 +0300

> http://www.best.com/~mikehan/PerlMenu

Seems like you want to reimplement fvwm-menu-directory, included in fvwm
2.3.7; it can even be in your $PATH. You can run it to get the correct
output; there are a lot of options (--help). Other fvwm-menu-* scripts
{desktop,headlines} use dynamic menus too and have good manpages.

> AddToMenu /home/mikehan DynamicPopdownAction DestroyMenu recreate /home/mikehan

This should actually be:

DestroyMenu recreate /home/mikehan
AddToMenu /home/mikehan MissingSubmenuFunction MakeMissingMenu
AddToMenu /home/mikehan DynamicPopdownAction DestroyMenu /home/mikehan

Everything else within your script seems to be correct.

> perhaps the manpage is "right" and the code is wrong?

Since all scripts shipped with fvwm, including Dominik's ones use
MissingSubmenuFunction, this should be the "right" name. :)

Regards,
Mikhael.
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]