[comp.sys.mac.programmer] Scrap Manager and Multifinder

mab@ecmwf.co.uk (Baudouin Raoult) (04/16/91)

	I try to put a picture in the clipboard. It work
fine except under Multifider. The stuff I put in the
clipboard is there in my application, but if I select an
other application, the clipboard is empty. Any clue ?

	I call ZeroScrap, then PutScrap. No error
are returned in both cases.

	Thanks, Baudouin.

-- 

---------------------------------------------------
Baudouin Raoult. 
European Center for Medium Range Weather Forecast
Reading, UK
---------------------------------------------------

REEKES@applelink.apple.com (Jim Reekes) (04/26/91)

In article <1991Apr16.115606.6398@ecmwf.co.uk>, mab@ecmwf.co.uk (Baudouin Raoult) writes:
> 
> 
> 	I try to put a picture in the clipboard. It work
> fine except under Multifider. The stuff I put in the
> clipboard is there in my application, but if I select an
> other application, the clipboard is empty. Any clue ?


Under System 6.0.x, if the Finder runs low on memory it may clear the scrap.
I've seen this happen if a large picture was copied.  When the Finder got
some background time, it finds itself low on memory and cleared the scrap.
Yes, it's very rude but it happens.

Try setting an a-trap break on ZeroScrap and UnloadScrap to see if this is
happening on your scrap handle.

Jim Reekes, Mac Toolbox Engineer

bdugan@teri.bio.uci.edu (Bill Dugan) (04/26/91)

In article <13191@goofy.Apple.COM> REEKES@applelink.apple.com (Jim Reekes) writes:
>In article <1991Apr16.115606.6398@ecmwf.co.uk>, mab@ecmwf.co.uk (Baudouin Raoult) writes:
>> 
>> 
>> 	I try to put a picture in the clipboard. It work
>> fine except under Multifider. The stuff I put in the
>> clipboard is there in my application, but if I select an
>> other application, the clipboard is empty. Any clue ?
>
>
>Under System 6.0.x, if the Finder runs low on memory it may clear the scrap.
>I've seen this happen if a large picture was copied.  When the Finder got
>some background time, it finds itself low on memory and cleared the scrap.
>Yes, it's very rude but it happens.
>
>Try setting an a-trap break on ZeroScrap and UnloadScrap to see if this is
>happening on your scrap handle.
>
>Jim Reekes, Mac Toolbox Engineer

A more probable fix:  You must use a SystemEdit call just before the
scrap call.  Some code that works for me:

if (SystemEdit(3))
	;
err = PutScrap(GetHandleSize(h),'PICT',*h);

Obviously, modify your PutScrap call so it works for your purpose.
The reason is that apparently the SystemEdit call fools Multifinder into
thinking that the user picked an option from the Edit menu and that it's
"OK" to convert the scrap into the Multifinder scrap, which are apparently
different things.

This FEATURE was pretty tough to figure out and I'm not sure where I finally
found it documented.

Cheers,

bill

d88-jwa@byse.nada.kth.se (Jon W{tte) (04/27/91)

In article <> bdugan@teri.bio.uci.edu (Bill Dugan) writes:

   if (SystemEdit(3))
	   ;
   err = PutScrap(GetHandleSize(h),'PICT',*h);

1) You'd most probably want to call SystemEdit ( 1 ) ; so as not to
fool any DA into making a "copy" operation...
2) You probably want to lock the handle h before calling PutScrap
with h dereferenced, since PutScrap may very well move memory.

   The reason is that apparently the SystemEdit call fools Multifinder into
   thinking that the user picked an option from the Edit menu and that it's

   This FEATURE was pretty tough to figure out and I'm not sure where I finally
   found it documented.

Most probably in the MF prog manual or the TechNotes (do a subject search
on Scrap or MultiFinder) where it's documented...

--
						Jon W{tte
						h+@nada.kth.se
						- Power !