[comp.sys.mac] Menus on the title bar.

buzz@phoenix.Princeton.EDU (Mahboud Zabetian) (01/22/88)

Does anyone know what the best way is to make a popup menu when you
option-click on the title bar of a window?  I seem to recall having seen it
before.

One way to do that is to fool the mac into thinking that the click is in the
menu bar, and having the menu manager handle the event.  But I don't want to 
do it that way since each window will have its own unique menu.(plus the
standard ones in the menu bar).

Any help will be appreciated.
-- 
Mahboud Zabetian				buzz@phoenix.princeton.edu
183 Little Hall 					(609) 520-1271
Princeton University, Princeton, NJ 08544		(609) 734-7760
****** Anyone need a soon-to-graduate hardware/software engineer? ********

dwb@apple.UUCP (David W. Berry) (01/23/88)

In article <1514@phoenix.Princeton.EDU> buzz@phoenix (Mahboud Zabetian) writes:
>
>Does anyone know what the best way is to make a popup menu when you
>option-click on the title bar of a window?  I seem to recall having seen it
>before.
>
>One way to do that is to fool the mac into thinking that the click is in the
>menu bar, and having the menu manager handle the event.  But I don't want to 
>do it that way since each window will have its own unique menu.(plus the
>standard ones in the menu bar).
>
>Any help will be appreciated.
	Presuming your an application and not a desk accessory you should
have something like the following:

	switch(event.what)
	{
	....
	case mouseDown:
		switch(FindWindow(&event.where, &window))
		{
		...
		case	inDrag:

Change what normally comes after inDrag, to test the modifiers
bits and call PopUpMenu (a new trap, test for it's existence as
in some tech note or other) if the option key is down, otherwise
handle inDrag as normal.

	Remember that option-click in the title bar isn't something
defined by the UI guidelines, so you will have to prominently
document it (ie., don't bury it in the manual, nobody reads it
anyway) or people won't know whatever feature you implement that
way exists.

	If you're a DA it gets a lot harder because the system
handles the clicks in your drag region (ie., the title bar)
>-- 
>Mahboud Zabetian				buzz@phoenix.princeton.edu
>183 Little Hall 					(609) 520-1271
>Princeton University, Princeton, NJ 08544		(609) 734-7760
>****** Anyone need a soon-to-graduate hardware/software engineer? ********


-- 
	David W. Berry
	dwb@well.uucp                   dwb@Delphi
	dwb@apple.com                   973-5168@408.MaBell
Disclaimer: Apple doesn't even know I have an opinion and certainly
	wouldn't want if they did.