seth@ZURICH.AI.MIT.EDU (08/25/89)
I'm trying to implement a system menu bar, and I'm having some problems. Here's a summary of the following question: How can I guarantee that a window which gets a button-press event will receive the corresponding button-release event, while allowing other windows to receive enter/leave-notify events in the interim? Is there some reason I shouldn't be trying to do this? ---------------------------------------------------------------------- The menu bar should embody the following semantics (simplified): - If the mouse button is pressed while in the menu bar, as long as the mouse button remains pressed, do this stuff: - If the mouse button was pressed while in a menu heading (as opposed to the whitespace on the right side of the menu bar), expose the corresponding menu underneath the menu heading. - If at any time the pointer moves over a different menu heading, hide the first menu and expose the appropriate new menu. - If at any time the pointer moves over the whitespace of the menu bar, just hide the first menu. - If at any time the pointer is moved over a menu, highlight and unhighlight the appropriate menu items. - When the mouse button is released, do this stuff: - Hide any exposed menu - If the mouse button was released over a menu item, perform the appropriate operation. ----------------------------------------------------------------------- Subject to these constraints: - I don't want to have any windows which cover the entire screen. - I'd like the menu bar to be a small strip across the top of the screen, with menus which are pulled down from it. Therefore, the menus cannot be children of the menu bar. ---------------------------------------------------------------------- These semantics leave open the question of who responds to button-press/release events and enter/leave-notify events. My dilemma is that SOMEONE (probably the menu bar or the menu heading) needs to select for button-press/release events. In order to catch the button release event (and clean up any exposed menus), whoever selects these events needs to NOT select owner-grab-button. However, if owner-grab-button is not selected, enter/leave-notify events for other windows (such as menu-items) are not dispatched. Any comments or suggestions would be appreciated! Thanks, Seth Goldstein (seth@zurich.ai.mit.edu) ConSolve, Inc.