[SOLVED] Passing Conditions to submenu items

Hi all,

Is it possible to use dynamic menus to pass conditions (EG all windows, current window, all Iconic, etc) from one menu to a universal, dynamic submenu?

For Example, I would like to have one “WindowsOpts” menu that I can use to operate on all sorts of windows (all, current, Iconic, Page 2, etc), not just the current one. However, writing a separate submenu for each “context” (and THEIR submenus) has resulted in a hell of a lot of menus.

What I have in mind is this:

WinOptsMenu

  • All
  • All (Desk)
  • All (Page)
  • Current
  • Iconic (All)
  • Iconic (Page)
  • Iconic (Desk)
  • ETC

And when I select one of the above, the Conditions are passed to a universal, dynamic submenu, with items such as:

WinOptsSubMenu

  • Close $[conditions] Close
  • (Un)Iconify $[conditions] Iconify
  • Maximize $[conditions] Maximize
  • MoveToPage $[conditions] MoveToPageAndFocusFunc
  • ETC

So how do I pass the conditions / contexts from the main menu to the items in the submenu?

I’ve changed the approach a bit, but the main problem remains. I still want to pass arguments from one menu to another, but I can’t.

So far, I’ve got two menus (WinOptsMenu and ObjectMenu).
WinOptsMenu contains the actions I want to take, EG Iconify, Close, Move, etc.
ObjectMenu contains the objects (things, mostly windows) I want to operate on, plus a positional argument, which should contain the command from the first menu.

[code]Key z A 4 PopUp WinOptsMenu

AddToMenu WinOptsMenu DynamicPopupAction WinOptsMenuFunc

AddToFunc WinOptsMenuFunc

  • I DestroyMenu WinOptsMenu Recreate
  • I AddToMenu WinOptsMenu “Window Options” Title
  • I ThisWindow (Iconifiable) AddToMenu WinOptsMenu Iconify PopUp ObjectMenu Iconify

AddToMenu ObjectMenu DynamicPopupAction ObjectMenuFunc

AddToFunc ObjectMenuFunc

  • I DestroyMenu ObjectMenu Recreate
  • I AddToMenu ObjectMenu “Select Object” Title
  • I AddToMenu ObjectMenu “Next” Next (AcceptsFocus, !Iconic) $0
  • I AddToMenu ObjectMenu “Previous” Prev (AcceptsFocus, !Iconic) $0
  • I AddToMenu ObjectMenu “” Nop
  • I AddToMenu ObjectMenu “Current” Current (!Iconic, !Sticky) $0
  • I AddToMenu ObjectMenu “Select” NoWindow Pick $0
  • I AddToMenu ObjectMenu “” Nop
  • I AddToMenu ObjectMenu “All (Desk)” All (CurrentDesk, !Iconic, !Sticky) $0
  • I AddToMenu ObjectMenu “All (Page)” All (CurrentPage, !Iconic, !Sticky) $0
  • I AddToMenu ObjectMenu “” Nop
  • I AddToMenu ObjectMenu “Iconic (Desk)” All (CurrentDesk, Iconic, !Sticky) $0
  • I AddToMenu ObjectMenu “Iconic (Page)” All (CurrentPage, Iconic, !Sticky) $0
  • I AddToMenu ObjectMenu “” Nop
  • I AddToMenu ObjectMenu “UnFocused (Desk)” All (CurrentDesk, !Focused, !Iconic, !Sticky) $0
  • I AddToMenu ObjectMenu “UnFocused (Page)” All (CurrentPage, !Focused, !Iconic, !Sticky) $0
  • I PopUp ObjectMenu[/code]
    This however does not work, because the following line from WinOptsMenuFunc does not pass arguments (in this case “Iconify”) to my “ObjectMenuFunc”:
+ I ThisWindow (Iconifiable) AddToMenu WinOptsMenu Iconify PopUp ObjectMenu Iconify

I have it kind of working by replacing the above line with the following, which calls my “ObjectMenuFunc” directly from the “WinOptsMenu”:

+ I ThisWindow (Iconifiable) AddToMenu WinOptsMenu Iconify Function ObjectMenuFunc Iconify

This, however, is less than ideal because when the function ObjectMenuFunc gets run, the parent menu (WinOptsMenu) closes. I would like it to behave like “PopUp” IE keep the parent menu open and allow me to go back into it, should I need to.

Does anyone have a way to pass arguments (commands, conditions, etc.) from one menu to another, while keeping the parent menu open?

EDIT:
Will mark original as solved, as I can indeed pass arguments from one menu to another, even if I need to call the dynamic menu functions directly (rather than using “PopUp”) and therefore do not get exactly the same behavior as I would with PopUp. What I have is good enough for me.