[comp.sys.next] Popup Menus

combs@sumex-aim.stanford.edu (Dave Combs) (05/19/89)

Does anyone have any decent suggestions about how to do regular pop-up
menus (without the hack that they have to be part of the "main" menu, and
be accessed through the right mouse button?)  I have a large number of 
very specific menus, so attaching all of them to the main menu is very
inelegant.
Thanks,
Dave  (combs@sumex-aim.stanford.edu)

mrc@Tomobiki-Cho.CAC.Washington.EDU (Mark Crispin) (05/20/89)

In article <23914@labrea.Stanford.EDU> combs@sumex-aim.stanford.edu (Dave Combs) writes:
>Does anyone have any decent suggestions about how to do regular pop-up
>menus (without the hack that they have to be part of the "main" menu, and
>be accessed through the right mouse button?)  I have a large number of 
>very specific menus, so attaching all of them to the main menu is very
>inelegant.


I have the same problem as Dave.  In 0.8, I ended up using modal panels
filled with buttons.  This caused me lots of fun and laughter in 0.9,
since 0.9 forcibly centers modal panels (and causes nested modal panels
to be placed so that their top-left corner is approximately 1 screen inch
lower and to the right of the previous panel).  I eventually created a
subclass of panels that has null methods for center: and moveTopLeftTo::
and which get placed where I want them to.

However, 0.9 does have two new facilities, see "Buttons That Bring Up
Lists" on page 44 of the 0.9 NeXT User's Reference Manual.  I'm going to
be moving to using them, and may be able to get rid of some of my modal
panels.

Mark Crispin / 6158 Lariat Loop NE / Bainbridge Island, WA 98110-2020
mrc@CAC.Washington.EDU / MRC@WSMR-SIMTEL20.Army.Mil / (206) 842-2385
Atheist & Proud / 450cc Rebel pilot -- a step up from 250cc's!!!
tabesaserarenakerebanaranakattarashii...kisha no kisha ga kisha de kisha-shita
sumomo mo momo, momo mo momo, momo ni mo iroiro aru
uraniwa ni wa niwa, niwa ni wa niwa niwatori ga iru

ali@polya.Stanford.EDU (Ali T. Ozer) (05/20/89)

In article <23914@labrea.Stanford.EDU> Dave Combs writes:
>Does anyone have any decent suggestions about how to do regular pop-up
>menus (without the hack that they have to be part of the "main" menu, and
>be accessed through the right mouse button?)  I have a large number of 
>very specific menus, so attaching all of them to the main menu is very
>inelegant.

You might want to use PopUpLists; they are used in the Page Layout panel,
in Interface Builder's project window (under Files), in Icon's compositing
mode selection, among other places. They allow you to bring up a list
of buttons (essentially a popup menu) on an event; they are usually 
tied to a button. There isn't any support for creating PopUpLists 
through Interface Builder; the best way to use them is to create a button
in IB, get a handle to it through an outlet, and use NXAttachPopUpList()
(I think that's what it's called) to attach a PopUpList to the button.

Ali Ozer, NeXT Developer Support
aozer@NeXT.com

quarrie@cds001.cebaf.gov (David Quarrie) (03/11/91)

--
This is a plea for help. I'm in the midst of porting some software that uses
popup menus extensively. I'd like these menus to have the semantics of the
"rightMouse" Application menu - i.e. on mouseDown the menu pops up at the
cursor location, the user then drags the mouse to the required menu item
and then releasing the mouse button both selects the item and hides the menu
again. I have no difficulty creating Menu objects with items (and
submenus etc.)
and causing them to appear at the cursor location:

	[menu MoveTo:x :y];
	[menu makeKeyAndOrderFront];

However, I've not been able to reproduce the semantics I want. The menu remains
visible until explicitly closed by the Application via:

	[menu close];

I've tried using [menu rightMouseDown:&event]; and that appears to ignore the
"menu" id it is given but only pops up the main application menu (it also 
doesn't appear to track properly, but that's probably finger problems on my 
part). Failing this, I've tried to make my menu appear with the close box
visible (by setting some of the menuFlags) but that doesn't appear to do
anything either. Any (constructive!) suggestions would be welcome (I know what
I'm trying to do violates the NeXT interface guidelines, but I'm trying to
compromise between those and what this software is built around). 

	David Quarrie
	CEBAF Physics Division

	quarrie@cds001.cebaf.gov