Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!sun-barr!apple!agate!ronzoni!lippin From: lippin@ronzoni.berkeley.edu (The Apathist) Newsgroups: comp.sys.mac.programmer Subject: Re: Simulating a Menu Bar with Pop-Up Menus Message-ID: <1989Dec6.050608.18445@agate.berkeley.edu> Date: 6 Dec 89 05:06:08 GMT References: <9095@hoptoad.uucp> <1989Nov28.053644.28100@agate.berkeley.edu> <2880@murtoa.cs.mu.oz.au> <1989Dec4.013339.20945@agate.berkeley.edu> <2891@murtoa.cs.mu.oz.au> Sender: usenet@agate.berkeley.edu (USENET Administrator;;;;ZU44) Reply-To: lippin@math.berkeley.edu Organization: Authorized Service, Incorporated Lines: 78 Recently rob@murtoa.UUCP (Robert Wallen) wrote: >Recently lippin@math.berkeley.edu writes: >>PopupMenuSelect, when used as directed, produces the correct result -- >>it goes to some trouble to put the item you choose under the mouse, >>and this can produce some funny looking scrolling menus if you're near >>the edge of the screen. >The correct result? So many times, I find that it scrolls the lot straight >away because I was positioned on the arrow... If you found yourself positioned on the arrow, then PopupMenuSelect wasn't used as directed. As described in IM and the Human Interface Guidelines, a popup menu looks like "Title: Menu Item" with a menu-shaped box around the menu item. When pressed, the title is highlighted, and a menu springs up around the item. The menu item doesn't budge, so if you let the mouse up without moving, the same item is selected. This is generally only used in dialog boxes. I can't think of a common example of this use, because few programs use it this way, but the folder ancestors menu in standard file has everything but the title. >>But when you're perverting PopupMenuSelect to serve other ends, the >>way menus are positioned may not be appropriate. >I think I dislike the term 'perverting'. What is PopUpMenuSelect supposed to >do if its not pop-up menus where the user clicks? Personally, I think this is >one of the arguments that Apple used to convince the world that it didnt steal >too liberally from Smalltalk -- Xerox seemed to handle popups properly >regardless of where the mouse was clicked 8-) I chose the word with care. PopupMenuSelect is not designed for menu bars in windows, windows that pull down from title bars of windows, nor for Smalltalk-style menus anywhere you click. And, as it happens, it doesn't work perfectly for these tasks, although hacks exist to make it work adequately. It might be better to have a new trap which was designed for these purposes, but I imagine that Apple is reluctant to create one when there is no HIG-blessed use for such a thing. Adding to the HIG is a slow and thoughtful process, and I don't doubt that this has been, and probably still is being considered. In the meantime, for those of us that can't resist, there's this hack. >>The best way I've found around this is to have the MDEF misinterpret >>the hPopUpMsg. >Once again, we come down to a custom MDEF. Apple DTS, are you reading this >string? If I need a custom MDEF, seems to me that MDEF-0 must be broken... It's not broken -- it's doing what it was designed for: trying to put the selected item in the place you chose for it. But for this hack, that's not what we want. >>For my menu bar in a window, for example, I use this to bounce the >>menu off the edge of the screen, so that it never has to scroll (given >>sufficiently short menus, of course. >How do you mean? Do you miscalculate the rectangle requested? Yes. I return a rectangle that's entirely on the screen, and which is large enough to hold the entire menu without scrolling. >>LSC 4.0, on the other hand, seems to use it to get the menu positioned >>properly underneath the title bar of the window -- in extreme cases, >>making the menu too small to use; Apple didn't (and had no reason to) >>provide for the possibility of scrolling menus less than 3 items long. >^^^^^ Apple DTS -- please take note If used in the blessed manner, the only way this should happen is if the monitor the menu is on is less than about 80 pixels high. Hardly a situation Apple should lose corporate sleep over. --Tom Lippincott lippin@math.berkeley.edu "Please do not defeat this important saftey feature."