From: peter@cujo.curtin.edu.au (Peter N Lewis)
Subject: Re: Adding Balloon help to my App...
Followup-To: comp.sys.mac.programmer
Organization: NCRPDA, Curtin University
Date: Thu, 3 Sep 1992 05:13:30 GMT

In article <1992Sep2.132611.23290@utkux1.utk.edu>, danny@utkux1.utk.edu
(Danny W. McCampbell) wrote:
> 
> Is there an easy way to add balloon help to my Application.
> I ready IM Vol VI and understand the resources, but when
> I create the resources in resedit I get the hex editor.
> Can anyone give me any tips on how to get started?

Whatever you do, don't use BalloonWriter or you'll spend more time fighting
it than adding balloons!  The best way I've found is to use ResEdit to
create the dialog, and then set the DITL resource's Balloon Help to
HMscanhdlg, ID <whatever>, and then use SARez, and life is relatively
simple.  Here's an example rez source:

#include "Types.r"
#include "BalloonTypes.r"

resource 'hdlg' (1002, "DITL 202") {
	2,
	0,
	0,
	0,
	0,
	HMSkipItem {

	},
	{	/* array HDialogArray: 10 elements */
		/* [1] */
		HMStringResItem {
			{0, 0},
			{0, 0, 0, 0},
			1002,
			1,
			0,
			0,
			0,
			0,
			0,
			0
		},
		/* [2] */
		HMStringResItem {
			{0, 0},
			{0, 0, 0, 0},
			1002,
			2,
			0,
			0,
			0,
			0,
			0,
			0
		},
		/* [3] */
		HMStringResItem {
			{0, 0},
			{0, 0, 0, 0},
			1002,
			3,
			0,
			0,
			0,
			0,
			0,
			0
		},
		/* [4] */
		HMSkipItem {

		},
		/* [5] */
		HMStringResItem {
			{0, 0},
			{0, 0, 0, 0},
			1002,
			4,
			0,
			0,
			0,
			0,
			0,
			0
		},
		/* [6] */
		HMStringResItem {
			{0, 0},
			{0, 0, 0, 0},
			0,
			0,
			0,
			0,
			1002,
			5,
			1002,
			5
		},
		/* [7] */
		HMStringResItem {
			{0, 0},
			{0, 0, 0, 0},
			1002,
			6,
			0,
			0,
			0,
			0,
			0,
			0
		},
		/* [8] */
		HMStringResItem {
			{0, 0},
			{0, 0, 0, 0},
			1002,
			7,
			0,
			0,
			0,
			0,
			0,
			0
		},
		/* [9] */
		HMStringResItem {
			{0, 0},
			{0, 0, 0, 0},
			1002,
			8,
			0,
			0,
			0,
			0,
			0,
			0
		},
		/* [10] */
		HMStringResItem {
			{0, 0},
			{0, 0, 0, 0},
			1002,
			9,
			0,
			0,
			0,
			0,
			0,
			0
		}
	}
};

resource 'STR#' (1002, "BH for hmnu 202") {
	{	/* array StringArray: 4 elements */
		/* [1] */
		"Click here to save the changes that you "
		"have made.  The changes will take effect"
		" for all future logins.",
		/* [2] */
		"Click here if you don't want to make any"
		" changes.",
		/* [3] */
		"Click here if you make a mistake and wis"
		"h to discard all the changes you have ma"
		"de.",
		/* [4] */
		"Type in the default directory here.  Thi"
		"s is the directory a user will start in "
		"if they are not explicitly listed in the"
		" menu below.",
		/* [5] */
		"Select a user with this menu, and then e"
		"dit their username and/or their startup "
		"directory.",
		/* [6] */
		"Click here if you wish to create a new u"
		"ser.  Then type in the users name and t"
		"he users initial directory.  Note that "
		"you only need to create a user if you wa"
		"nt to give them an initial directory - a"
		"ll the users in your Users & Groups file"
		" can login.\n",
		/* [7] */
		"Click here to delete the currently selec"
		"ted user.",
		/* [8] */
		"This is the username of the selected use"
		"r.  When a user with this name logs in t"
		"hey will start in the directory specifie"
		"d below.",
		/* [9] */
		"This is the initial directory for the se"
		"lected user.  When they log in they will"
		" start in this directory.  Type it in as"
		" you would enter it in a cd command if"
		" you had logged in from a standard Un*x "
		"FTP client."
	}
};

The hdlg resource has items for each dialog item.  There is a hdlg item in
the array for each DITL item, and each hdlg item has four strings (STR# id,
index pairs) attached to it (Normal, Disabled, Checked, something else). 
Just use the first one, and if it doesn't work try the others... (there are
some bizzare cases, like for PopUps, it uses one if the first menu item is
currently selected and another if not...)

This requires much less effort than fighting with Balloon Writer!

Have fun all,
   Peter.

_______________________________________________________________________
Peter N Lewis, NCRPDA, Curtin University       peter@cujo.curtin.edu.au
GPO Box U1987, Perth WA 6001, AUSTRALIA             FAX: +61 9 367 8141