[ Previous | Next | Contents | Glossary | Home | Search ]
Motif 2.1 Programmer's Guide



TearOffMenus

An application can allow the user to "tear off" a PulldownMenu or PopupMenu. When the user tears off a menu, Motif unposts that menu and any posted menu descendants. It gives the menu a TransientShell parent and then maps the parent as a top-level window. The torn-off menu has window-manager decorations, and its title can be specified with the XmNtearOffTitle resource of the RowColumn menu widget. If the title is not so specified, it will be the same as the label of the CascadeButton that posts the menu in the original menu system.

The user can interact with the torn-off menu just as in the menu hierarchy. When the user activates buttons in a torn-off menu, the actions take effect but the torn-off menu remains posted. When the user takes an action that unposts the torn-off menu, such as pressing osfCancel, the menu returns to its original position in the menu hierarchy. If the user reposts the original menu from the menu hierarchy while the torn-off menu is posted, an inactive representation of the torn-off menu remains visible, but the menu itself is unposted and then reposted within the menu hierarchy.

When a menu in a menu system can be torn off, a distinctive tear-off button appears at the beginning of the menu. The user can tear off the menu by activating the tear-off button as with any other button in the menu. The user can also tear off the menu by pressing Btn2 in the tear-off button. The user can then drag the torn-off menu to another position on the screen and fix its position by releasing Btn2.

Menus cannot be torn off by default. The application must allow the user to tear off a menu by setting the RowColumn resource XmNtearOffModel to XmTEAR_OFF_ENABLED. When the user tears off a menu, the XmNtearOffMenuActivateCallback callbacks are invoked just before the XmNmapCallback callbacks. When the user unposts a torn-off menu, the XmNtearOffMenuDeactivateCallback callbacks are invoked just after the XmNunmapCallback callbacks.


[ Previous | Next | Contents | Glossary | Home | Search ]