[comp.sys.mac.programmer] Hierarchical Menus in DAs

barry@world.std.com (Barry L Wolman) (05/12/91)

IM-V page 236 says that the ID for hierarchical menus used by a DA must
be in the range 236-255.  Fine, but how do I number my two menus so as
to avoid a conflict with hierarchical menus used by some other DA.  If
my DA is accessed via Suitcase II or MasterJuggler, there doesn't seem
to be a problem.  But, if I've used Font DA mover to move my DA into a
suitcase, how can I determine the new IDs assigned by Font DA mover?
I suppose I could assign names to them, load them via GetNamedResource
and then use GetResInfo to determine the ID.  Is there a better way?

Suppose I try to put multiple DAs into a suitcase, each of them having
some hierarchical menus.  Font DA mover will renumber the menu IDs, but
there are only twenty available numbers.  What happens if there are more
than twenty hierarchical menus?

Why am I worrying about this with 7.0 about to be released?!  Seriously,
can anyone tell me definitively how all of this changes in 7.0 when
Font DA mover has been dodo-ized?

Thanks,
Barry Wolman


-- 
Barry Wolman
159 Oxbow Road
Needham, MA 02192
617-449-3874

resnick@cogsci.uiuc.edu (Pete Resnick) (05/13/91)

barry@world.std.com (Barry L Wolman) writes:

>IM-V page 236 says that the ID for hierarchical menus used by a DA must
>be in the range 236-255.  Fine, but how do I number my two menus so as
>to avoid a conflict with hierarchical menus used by some other DA.  If
>my DA is accessed via Suitcase II or MasterJuggler, there doesn't seem
>to be a problem.  But, if I've used Font DA mover to move my DA into a
>suitcase, how can I determine the new IDs assigned by Font DA mover?
>I suppose I could assign names to them, load them via GetNamedResource
>and then use GetResInfo to determine the ID.  Is there a better way?

The menu *IDs* have to be in the range 236-255, not the *resource*
numbers.  The resource numbers should be set up as usual for DA owned
resources.

>Suppose I try to put multiple DAs into a suitcase, each of them having
>some hierarchical menus.  Font DA mover will renumber the menu IDs, but
>there are only twenty available numbers.  What happens if there are more
>than twenty hierarchical menus?

Check me on this, but so long as you have unique resource numbers,
duplicate menu IDs should not be a problem.

pr
--
Pete Resnick             (...so what is a mojo, and why would one be rising?)
Graduate assistant - Philosophy Department, Gregory Hall, UIUC
System manager - Cognitive Science Group, Beckman Institute, UIUC
Internet/ARPAnet/EDUnet  : resnick@cogsci.uiuc.edu
BITNET (if no other way) : FREE0285@UIUCVMD

ech@cbnewsk.att.com (ned.horvath) (05/13/91)

From article <1991May11.214528.18598@world.std.com>, by barry@world.std.com (Barry L Wolman):
> IM-V page 236 says that the ID for hierarchical menus used by a DA must
> be in the range 236-255.  Fine, but how do I number my two menus so as
> to avoid a conflict with hierarchical menus used by some other DA...

Don't confuse the menu's resource ID (which should be in the range "owned"
by your DA, hence no conflicts with other DAs) with the menuID, which is
the short integer given by the first two bytes of the MENU resource.  Most
app writers keep these identical to avoid confusion, but they needn't be,
and in the original (pre-7.0, no Suitcase-like utility installed) they 
pretty well have to be different: Font/DA Mover will remap the resourceIDs
when there's a conflict, but won't modify that menuID (as far as I know!).

=Ned Horvath=
ehorvath@attmail.com
-- 

=Ned Horvath=
ehorvath@attmail.com

dorner@pequod.cso.uiuc.edu (Steve Dorner) (05/14/91)

In article <1991May12.205320.21492@cbnewsk.att.com> ech@cbnewsk.att.com (ned.horvath) writes:
>Don't confuse the menu's resource ID (which should be in the range "owned"
>by your DA, hence no conflicts with other DAs) with the menuID, which is
>the short integer given by the first two bytes of the MENU resource.  Most
>app writers keep these identical to avoid confusion, but they needn't be,

Careful.  The popup menu cdef supplied with the 6.0.x version of the CTB
REQUIRES that menuid==resource id.  The requirement is undocumented, but
it's definitely there.  Yet another obscure detail to delight us all...

I don't know if the same is true with the System 7 popup CDEF.
--
Steve Dorner, U of Illinois Computing Services Office
Internet: s-dorner@uiuc.edu  UUCP: uunet!uiucuxc!uiuc.edu!s-dorner