[comp.sys.mac.programmer] Hierarchical menu question

des@orenda.amara.uucp (Dave Steinhoff) (04/28/89)

I am currently developing an application that requires a large number
of menus.  The hierarchical menu mechanism is ideal to help me shrink
the number of distinct menus I need by having many 'paths' through
the menus end up at the same final menu (a DAG).  However, I also need
to know what the intermediate selections were along the way in order
to distinguish special cases.  So, for example:

    menu 101               menu 102               menu 103
  +---------+            +---------+            +---------+
  |    a    |-----       |    e    |            |    h    |
  |    b    |     \----->|    f    |----------->|    i    |
  |    c    |            |    g    |            +---------+
  |    d    |            +---------+
  +---------+

...returns from MenuSelect a longword result of integer pairs 103/2.
I would also like to capture the pairs 101/1, 102/2.  Does anyone
know if the standard menu defproc can be twiddled to give me this
information?  

Thanks for any help,
Dave
--
-------------------------------------------------------------------
Dave Steinhoff                       Applied Dynamics International
des@amara.UUCP                       3800 Stone School Rd.
...uunet!amara!des                   Ann Arbor, Mi 48108
-------------------------------------(313)973-1300-----------------

dwb@sticks.apple.com (David W. Berry) (04/29/89)

In article <DES.89Apr27123344@orenda.amara.uucp> des@orenda.amara.uucp (Dave Steinhoff) writes:
>
>I am currently developing an application that requires a large number
>of menus.  The hierarchical menu mechanism is ideal to help me shrink
>the number of distinct menus I need by having many 'paths' through
>the menus end up at the same final menu (a DAG).  However, I also need
>to know what the intermediate selections were along the way in order
>to distinguish special cases.  So, for example:
>
>    menu 101               menu 102               menu 103
>  +---------+            +---------+            +---------+
>  |    a    |-----       |    e    |            |    h    |
>  |    b    |     \----->|    f    |----------->|    i    |
>  |    c    |            |    g    |            +---------+
>  |    d    |            +---------+
>  +---------+
	Gaackkk.....  To quote some immortal who may claim the
	quote if he so desires:

	"Hierarchical menus are a bad dream.  If you ignore them
	they'll go away."

	Hierarchical menus do have some uses.  Unfortunately they tend
	to get over used.  For a prime example see WingZ.  Although
	I am in general very pleased with WingZ, I am incredibly annoyed
	that almost everything I want to do has to be done via a
	hierarchical menu choice.
>
>...returns from MenuSelect a longword result of integer pairs 103/2.
>I would also like to capture the pairs 101/1, 102/2.  Does anyone
>know if the standard menu defproc can be twiddled to give me this
>information?  
	MenuSelect will return 0 if 101/1 or 102/2 is selected.  After
	that you can call pascal long MenuChoice(void) to determine
	which disabled item was selected.  For you assembly hackers
	you can look at MenuDisable (0xb54) to get the same information.

	MenuDisable is stuffed by the standard def proc, so if a
	custom menu proc is being used it may contain garbage.

Opinions:  MINE, ALL MINE! (greedy evil chuckle)

David W. Berry		(A/UX Toolbox Engineer)
dwb@apple.com		973-5168@408.MaBell		AppleLink: berry1

tecot@Apple.COM (Ed Tecot) (05/15/89)

In article <1579@internal.Apple.COM> dwb@sticks.apple.com (David W. Berry) writes:
>In article <DES.89Apr27123344@orenda.amara.uucp> des@orenda.amara.uucp (Dave Steinhoff) writes:
>>
>>I am currently developing an application that requires a large number
>>of menus.  The hierarchical menu mechanism is ideal to help me shrink
>>the number of distinct menus I need by having many 'paths' through
>>the menus end up at the same final menu (a DAG).  However, I also need
>>to know what the intermediate selections were along the way in order
>>to distinguish special cases.  So, for example:
>>
>>    menu 101               menu 102               menu 103
>>  +---------+            +---------+            +---------+
>>  |    a    |-----       |    e    |            |    h    |
>>  |    b    |     \----->|    f    |----------->|    i    |
>>  |    c    |            |    g    |            +---------+
>>  |    d    |            +---------+
>>  +---------+
>	Gaackkk.....  To quote some immortal who may claim the
>	quote if he so desires:
>
>	"Hierarchical menus are a bad dream.  If you ignore them
>	they'll go away."

Hey!  That's me!  As the number one critic of hierarchical menus, I'm
sorry to inform you that that the Menu Manager does not provide any help
for what you want to do, in spite of the fact that it is about the only
legitimate reasons for hierarchical menus I can think of, for example, to
select a font, size, and style all with one gesture.  You might be
able to fake it with a custom MDEF, but I can't imagine how.

>>
>>...returns from MenuSelect a longword result of integer pairs 103/2.
>>I would also like to capture the pairs 101/1, 102/2.  Does anyone
>>know if the standard menu defproc can be twiddled to give me this
>>information?  
>	MenuSelect will return 0 if 101/1 or 102/2 is selected.  After
>	that you can call pascal long MenuChoice(void) to determine
>	which disabled item was selected.  For you assembly hackers
>	you can look at MenuDisable (0xb54) to get the same information.
>
>	MenuDisable is stuffed by the standard def proc, so if a
>	custom menu proc is being used it may contain garbage.

This is correct, but I doubt it will help you that much, since MenuChoice
will return 103/1 when MenuSelect returns 103/1, giving you no clue as
to the path to reach it.  In addition, MenuKey will be completely bewildered
as to the parent of any keyboard shortcuts in the hierarchical menus.

As a side note, I'd point out that the use of globals is strongly discouraged;
even assembly hackers should use MenuChoice.  Also, from IM I-109, resources
with IDs 0 through 127 are reserved for the system.

						_emt

tim@hoptoad.uucp (Tim Maroney) (05/16/89)

In article <30697@apple.Apple.COM> tecot@Apple.COM (Ed Tecot) writes:
>As a side note, I'd point out that the use of globals is strongly discouraged;
>even assembly hackers should use MenuChoice.

Except that, despite its inclusion in Inside Mac V, it is not implemented
and quite possibly never will be.
-- 
Tim Maroney, Consultant, Eclectic Software, sun!hoptoad!tim
"The negro slaves of the South are the happiest, and, in some sense, the
 freest people in the world.  The children and the aged and infirm work not
 at all, and yet have all the comforts and neccessaries of life provided for
 them." -- George Fitzhugh, CANNIBALS ALL! OR, SLAVES WITHOUT MASTERS, 1857

darin@Apple.COM (Darin Adler) (05/21/89)

In article <7303@hoptoad.uucp> tim@hoptoad.UUCP (Tim Maroney) writes:
> In article <30697@apple.Apple.COM> tecot@Apple.COM (Ed Tecot) writes:
> >As a side note, I'd point out that the use of globals is strongly discouraged
> >even assembly hackers should use MenuChoice.
> 
> Except that, despite its inclusion in Inside Mac V, it is not implemented
> and quite possibly never will be.

WRONG, WRONG, WRONG. I just looked at all my Macintosh IIs and they all had
MenuChoice (trap word $AA26). Where did you get the idea that it was not
implemented, Tim?
-- 
Darin Adler, System Software Scapegoat, Apple Computer
	Internet: darin@Apple.com
	UUCP: {nsc,sun}!apple!darin