[comp.sys.mac.programmer] Thanks for the Help

kevin@crash.cts.com (Kevin Hill) (01/17/91)

  Well, I learned my lesson, next time I ask a question about any
language, I will surely post the variable declarations to the net.
Sorry Guys!
  The problem was that I was using the declaration int surround[9]
as if I could use the variable surround[9].  That was mistaken, and
as someone pointed out, I can't, well shouldn't use the variable
surround[9] becuase it would probably overwrite the variable that
was next in memory.  Guess what everyone, It was overwriting
one of the variables of the for loop that was overwritten!!  Thanks.

wildfire@aix02.aix.rpi.edu (Douglas B Rusch) (01/17/91)

I seem to be having a great deal of difficulty getting the dialog manager
to draw my userItem. It seems that when I attempt to return from the 
function in which the drawing occurs, that it is returning to some unknown
memory location (somewhere not in my program atleast) and crashing. I have
been writing this on a Mac IIci with Think C 4.0.

I call the routines to set up the function call as follows :

GetDItem(theDialog,itemNo,&itemType,&item,&box);
item = (Handle)DrawItem;
SetDItem(theDialog,itemNo,itemType,item,&box);

Then I use DrawDialog(theDialog) to draw it. The problem does not have anything
with what happens in my Draw function. Any insights into this problem would be greatly appreciated.

Doug Rusch -RPI

bin@primate.wisc.edu (Brain in Neutral) (01/18/91)

From article <D13^*Y%@rpi.edu>, by wildfire@aix02.aix.rpi.edu (Douglas B Rusch):
> I seem to be having a great deal of difficulty getting the dialog manager
> to draw my userItem. It seems that when I attempt to return from the 
> function in which the drawing occurs, that it is returning to some unknown
> memory location (somewhere not in my program atleast) and crashing. I have
> been writing this on a Mac IIci with Think C 4.0.

I don't know if this is your problem, but one quick 'n' easy way to
crash a program is to forget to declare routines that are passed
as callbacks to ToolBox routines as *pascal* routines.

If your function is
	DrawItem (...)
instead of
	pascal DrawItem(...)
you'll have some difficulties.
--
Paul DuBois
dubois@primate.wisc.edu