[comp.sys.mac.programmer] What's happening ?

matherr@cs.glasgow.ac.uk (Ross M Mather) (03/16/90)

Can anyone tell me why the following happens when I added the following chunk of
code to my program recently:

What happens is that after running and examining all the About box then quitting
If I modify any part of the program and run it (in Think Pascal) it will start
to compile the altered unit and will hang. (No system error, just no mouse 
movement)

The effect is unrecreatable using a built application.

Any suggestions welcome
Ta Much
Ross

	procedure DoCredits;
		const
			CreditsBox = 129;
			FirstCredits = 151;
			SecondCredits = 152;
			AbandonItem = 1;
			Credits = 2;
			theSound = 129;
		var
			theBox: DialogPtr;
			hit: integer;
			curr: integer;
			itemType: integer;
			itemHandle: Handle;
			itemBox: Rect;
			thePic: PicHandle;
			otherPort: GrafPtr;
	begin
		GetPort(otherPort);
		curr := SecondCredits;
		theBox := GetNewDialog(CreditsBox, nil, pointer(-1));
		SetPort(theBox);
		GetDItem(theBox, Credits, itemType, itemHandle, itemBox);
		Hit := Credits;
		repeat
			if Hit = Credits then
				begin
					if curr = FirstCredits then
						curr := SecondCredits
					else
						curr := FirstCredits;
					thePic := GetPicture(curr);
					EraseRect(itemBox);
					DrawPicture(thePic, itemBox);
				end;
			ModalDialog(nil, Hit);
		until Hit = AbandonItem;
		DisposDialog(theBox);
		SetPort(otherPort);
	end;


{Handle everyting to do with displaying the about box}
	procedure DoAbout;
		const
			AboutBox = 128;
			OKItem = 2;
			IconItem = 1;
		var
			AboutBoxPtr: DialogPtr;
			Hit: integer;
			SavePort: grafPtr;
	begin
		GetPort(SavePort);
		AboutBoxPtr := GetNewDialog(AboutBox, nil, pointer(-1));
		SetPort(AboutBoxPtr);
		repeat
			ModalDialog(nil, Hit);
			if Hit = IconItem then
				DoCredits;
		until Hit = OKItem;
		DisposDialog(AboutBoxPtr);
		SetPort(SavePort);
	end;

end.
-- 
* USEnet   :  matherr!glasgow!mcsun!...  |  Senior Honours,Comp. Sci. Dept.    *
* ARPAnet  :  matherr@cs.glasgow.ac.uk   |  University Of Glasgow, Scotland.   *
* From USA :  matherr%cs.glasgow.ac.uk@nsfnet-relay.ac.uk                      *
*     If I hadn't want it heard I wouldn't have said it - Klingon Proverb      *