[comp.sys.mac.programmer] Custom CDEF Installation woes...

spencer@cgrg.ohio-state.edu (Stephen N. Spencer) (04/26/91)

I've been writing a custom CDEF which really is quite simple.  I draw around
the contrlRect, and have a list of H and V values which I (a) draw edges 
between and (b) draw circles at.  The user can click in one of the circles
and the circle turns black.  If the user selects another circle, the currently
black circle turns white and the new one turns black.  Really simple.

I have been testing it by the "install the dummy CDEF stub in the resource
file" method posted to the 'net by Phil Shapiro of Symantec, and the code
works beautifully in the test application.  (Can you see what's coming...)

Well, I build another THINK C project, which only has the CDEF source and
the MacTraps library.  I change the name of the 'main' function back to 'main'
and re-compile the CDEF source, and make a code resource.

I have yet another THINK C project which I use to test the stand-alone CDEF.
I cut-n-paste the code resource into it's resource file, and run it.

Bad news.  The frame around the CDEF is OK.  One or two of the circles get
drawn, but in the wrong locations.  Edges are drawn every which way.  The
circles that ARE drawn don't get painted black when I click in them.

I tried to set the port to the control's 'contrlOwner' but that didn't help
any.  I made sure that my list of H and V values were 'int' instead of 'short'.
That didn't help any either.  

I realize it's hard to debug code over the network, but anyone have any ideas
as to why this is doing what it's doing?  What is so different about the
context in which it's running that it would draw so differently?

Thanks for ANY help that anyone can provide.  

Stephen N. Spencer  ACCAD - The Ohio State University
1224 Kinnear Road   Columbus, OH  43212-1154
spencer@cgrg.ohio-state.edu

spencer@cgrg.ohio-state.edu (Stephen N. Spencer) (04/26/91)

Never mind.  It had to do with (a) global variables in my CDEF source code, 
and (b) not doing:

#include "SetUpA4.h"

	RememberA0();  <-- in the 'main' CDEF function
	SetUpA4();

	...

	RestoreA4();

I'd never used globals in a CDEF before, so didn't know to include this.
After I posted the original I thought to call a friend who might help.
He did.  It now works.  


Sorry for the inconvenience.

steve