# Popup

`Popup` PopupName position default-action

This command has two purposes: to bind a menu to a key or mouse button, and to bind a sub menu into a menu. The formats for the two purposes differ slightly. The position arguments are the same as for . The command default-action is invoked if the user clicks a button to invoke the menu and releases it immediately again (or hits the key rapidly twice if the menu is bound to a key). If the default action is not specified, double clicking on the menu does nothing. However, if the menu begins with a menu item (i.e. not with a title or a separator) and the default action is not given, double clicking invokes the first item of the menu (but only if the pointer really was over the item).

To bind a previously defined pop-up menu to a key or mouse button:

The following example binds mouse buttons 2 and 3 to a pop-up called "Window Ops". The menu pops up if the buttons 2 or 3 are pressed in the window frame, side-bar, or title-bar, with no modifiers (none of shift, control, or meta).

     2 FST N Popup "Window Ops"
     3 FST N Popup "Window Ops"

Pop-ups can be bound to keys through the use of the command. Pop-ups can be operated without using the mouse by binding to keys and operating via the up arrow, down arrow, and enter keys.

To bind a previously defined pop-up menu to another menu, for use as a sub menu:

The following example defines a sub menu "Quit-Verify" and binds it into a main menu, called "RootMenu":

     Quit-Verify
     + "Really Quit Fvwm?"
     + "Yes, Really Quit"
     + "Restart Fvwm"
     + "Restart Fvwm 1.xx"  fvwm1 -s
     + ""
     + "No, Don't Quit"

     RootMenu "Root Menu"
     + "Open XTerm Window" Popup NewWindowMenu
     + "Login as Root"      exec xterm -T Root -n Root -e su -
     + "Login as Anyone"    AnyoneMenu
     + "Remote Hosts"       HostMenu
     + ""
     + "X utilities"       Popup Xutils
     + ""
     + "Fvwm Modules"      Popup Module-Popup
     + "Fvwm Window Ops"   Popup Window-Ops
     + ""
     + "Previous Focus"     (AcceptsFocus)
     + "Next Focus"         (AcceptsFocus)
     + ""
     + "Refresh screen"
     + ""
     + "Reset X defaults"   xrdb -load \
                           $HOME/.Xdefaults
     + ""
     + ""
     +                 Popup Quit-Verify

Popup differs from in that pop-ups do not stay up if the user simply clicks. These are popup-menus, which are a little hard on the wrist. menus stay up on a click action. See the command for an explanation of the interactive behavior of menus. A menu can be open up to ten times at once, so a menu may even use itself or any of its predecessors as a sub menu.