[comp.sys.mac.programmer] Help Manager resources 'hfdr' 'hmnu' 'hwin' etc ....

bda@uther.calvin.edu (Bruce Abernethy) (06/10/91)

I am trying to create some resources to utilize the Help Manager in System 7
but there are no TMPLs in ResEdit 2.1 for these resources.  In addition,
my versions of SARez (3.2) aand Rez (MPW 3.1) do not seem to like the
resource code in InsideMacintoshVI.  Are ther updated versions of these
resource editors available?  Or is there a better way? (i.e. this mysterious
"BaloonWriter" that some people have mentioned).


--
Bruce Abernethy                                         
Calvin College Computer Center Hotline  X8555; (616) 957-8555
Grand Rapids, MI 49546
<bda@uengr.calvin.edu>

rcbalc@rwa.urc.tue.nl (Luc Cluitmans) (06/11/91)

In article <bda.676562481@uther> bda@uther.calvin.edu (Bruce Abernethy) writes:
>I am trying to create some resources to utilize the Help Manager in System 7
>but there are no TMPLs in ResEdit 2.1 for these resources.  In addition,
>my versions of SARez (3.2) aand Rez (MPW 3.1) do not seem to like the
>resource code in InsideMacintoshVI.  Are ther updated versions of these
>resource editors available?  Or is there a better way? (i.e. this mysterious
>"BaloonWriter" that some people have mentioned).

I've been searching for these TMPL's too but I couldn't find them either. 
IM VI isn't very helpfull on describing what's in these resources at byte
level, so I couldn't use the HEX-editor to create them. However, by looking
at an application that contained help-resources (Applicon) I found out
what bytes weren't described in IM-VI. As far as I can remember (I don't
have my mac here, so I can't check) the 'hmnu'-resource was build as follows:
 The header consists of 4 words; Normally they are(in HEX): 0002 0000 0000 0000
 Then comes a longword containing the number of help items in the menu
 (including the menu-title, but excluding the default-items). When there's
 one item in the menu this will be 0000 0002.
 Then follow the help-blocks. As described in IM-VI: one block for defaults,
 one block for the menu title, and then one block for each menu item.
 Each block begins with a word containing the length of the block.
 After this there's the type of help. I remember 0100 for SkipItem and
 0003 for STR#-based item. 
 What follows depends on the type. 
  For a SkipItem nothing follows. (so a full SkipItem is 0004 0100)
  For a STR#-based item 4 doublewords follow: each is the resource-id and
   index for a STR#-resource with the help-text.
   The first doubleword points to the help text fo a normal menu-item.
   The second is for a hidden menu-item
   The third and fourth are for checked and marked menu-items.
 I Don't know about the other types. Look at IM-VI and take a guess; it
 shouldn't be difficult.

To conclude: a hmnu-resource for a menu with two normal items divided
by a divide line is (referring to STR# 1234):
0002 0000 0000 0000 ; Normal header
0000 0004           ; four items excluding defaults
0004 0100           ; No defaults (SkipItem)
0014 0003 1234 0001 1234 0002 1234 0001 1234 0001 ; menu title
0014 0003 1234 0003 1234 0004 1234 0005 1234 0006 ; first item
0004 0100           ; Dividing line (SkipItem)
0014 0003 1234 0007 1234 0008 1234 0009 1234 000A ; second item

Remember: I'm typing this from memory and I can't check it at the moment
but I hope I didn't make any mistakes.

Greetings from the Netherlands,
               Luc Cluitmans, rcbalc@urc.tue.nl


-- 
............................................................................
 Luc Cluitmans                                              rcbalc@urc.tue.nl
 Don't Worry, Be happy!
 (Signature under construction... Be patient.)

peirce@outpost.UUCP (Michael Peirce) (06/11/91)

The Ballon help resource are defined in BallonHelp.r in the latest
MPW.

Here's the definition for hfdr:

/*----------------------------hfdr % Help Mgr Finder Application Balloon Template-------------------------*/
type 'hfdr' {
		integer;									/* Help Version 		*/
		longint;									/* Options				*/
		integer;									/* Balloon ProcID		*/
		integer; 									/* Balloon Variant		*/
		integer = $$CountOf(HFdrArray);				/* Count of hfdr Msgs	*/

		array HFdrArray {
				switch {
					case HMStringItem:
hfdrStringBeg:			integer = (hfdrStringEnd[$$ArrayIndex(HFdrArray)] - hfdrStringBeg[$$ArrayIndex(HFdrArray)]) / 8;
						key int = HMStringItemID;	/* helpType			*/
						pstring;					/* STR255			*/
						align word;					/* keep aligned		*/
hfdrStringEnd:
					case HMPictItem:
hfdrPictBeg:			integer = (hfdrPictEnd[$$ArrayIndex(HFdrArray)] - hfdrPictBeg[$$ArrayIndex(HFdrArray)]) / 8;
						key int = HMPictItemID;		/* helpType			*/
						integer;					/* Picture Res ID	*/
hfdrPictEnd:
					case HMStringResItem:
hfdrStringResBeg:		integer = (hfdrStringResEnd[$$ArrayIndex(HFdrArray)] - hfdrStringResBeg[$$ArrayIndex(HFdrArray)]) / 8;
						key int = HMStringResItemID;/* helpType			*/
						integer; integer;			/* STR# ID, index #	*/
hfdrStringResEnd:
					case HMTEResItem:
hfdrTEResBeg:			integer = (hfdrTEResEnd[$$ArrayIndex(HFdrArray)] - hfdrTEResBeg[$$ArrayIndex(HFdrArray)]) / 8;
						key int = HMTEResItemID;	/* helpType			*/
						integer;					/* TextEdit res ID	*/
hfdrTEResEnd:
					case HMSTRResItem:
hfdrSTRResBeg:			integer = (hfdrSTRResEnd[$$ArrayIndex(HFdrArray)] - hfdrSTRResBeg[$$ArrayIndex(HFdrArray)]) / 8;
						key int = HMSTRResItemID;	/* helpType			*/
						integer;					/* STR res ID		*/
hfdrSTRResEnd:
					case HMSkipItem:
hfdrSkipBeg:			integer = (hfdrSkipEnd[$$ArrayIndex(HFdrArray)] - hfdrSkipBeg[$$ArrayIndex(HFdrArray)]) / 8;
						key int = HMSkipItemID;		/* skip item (leave a hole) */
hfdrSkipEnd:
				};
		};
};

--  Michael Peirce         --   outpost!peirce@claris.com
--  Peirce Software        --   Suite 301, 719 Hibiscus Place
--  Macintosh Programming  --   San Jose, California 95117
--           & Consulting  --   (408) 244-6554, AppleLink: PEIRCE