Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!tecot From: tecot@Apple.COM (Ed Tecot) Newsgroups: comp.sys.mac.programmer Subject: Re: Hierarchical menu question Message-ID: <30697@apple.Apple.COM> Date: 15 May 89 03:50:38 GMT References: <1579@internal.Apple.COM> Distribution: na Organization: Apple Computer Inc, Cupertino, CA Lines: 53 In article <1579@internal.Apple.COM> dwb@sticks.apple.com (David W. Berry) writes: >In article 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