[comp.sys.mac.programmer] Scrap Manager Problem

jyp@wucs1.wustl.edu (Jerome Yvon Plun) (01/22/91)

I applied the solution(s) given on the net and I got some results. My current
code is now:

retZero = ZeroScrap();
if (SystemEdit(3));	/* trick to fool MultiFinder */
retPut = PutScrap(lengthScrap,'TEXT',toScrap);
if (SystemEdit(3));	/* trick to fool MultiFinder */
retval = UnloadScrap();

I put two calls to SystemEdit(3) since I got two answers suggesting to put the
call respectively before and after PutScrap.

This still works in my program (!) BUT I found the following interesting 
behavior:

If I build an application or just run through the Think C Debugger, I get an
empty Clipboard after the execution (using Finder "Show Clipboard" command)
even though I put 17 characters in it (checked after the code I listed above).

On the other hand, if I put a breakpoint on the second SystemEdit statement,STEP
"over" it and then GO to completion, I get exactly what I expect in the 
clipboard.

I tried to STEP over the other statemts, removing the call to UnloadScrap, I
always get an empty scrapbook if I run over the second SystemEdit and get a
correct scrapbook if I step over the second SystemEdit.

Some additional details:
  I am using the Class Library, the objects involved in the operation are all
  locked, Think C is version 4.0.2, System 6.0.7 and MultiFinder 6.1b9.

Soooooooo,  can some Think C Guru explain me why I get different behaviors 
depending on the timing of actions???

Jerome


Jerome Plun	jyp@wucs1.wustl.edu       // Tell me why is it so hard to say
Dept of Computer Science                  // Brother don't you walk away
Washington University                     //
St. Louis, Mo                             // Hooters     "Zig Zag"