P.PRIAPUS@HAMLET.STANFORD.EDU (Bill Lipa) (12/02/87)
Here is a small Lightspeed Pascal program which demonstrates the problems I am having getting MultiFinder to recognize that I have changed the contents of the clipboard: program testClipboard; var thePicture : PicHandle; bounds : Rect; pictureSize : Size; result : longint; begin SetRect(bounds, 0, 0, 100, 100); ClipRect(bounds); thePicture := OpenPicture(bounds); MoveTo(0, 0); LineTo(100, 100); ClosePicture; HLock(Handle(thePicture)); pictureSize := GetHandleSize(Handle(thePicture)); result := ZeroScrap; if result = NoErr then begin result := PutScrap(pictureSize, 'PICT', Ptr(thePicture^)); if result = NoErr then result := LoadScrap; end; HUnlock(Handle(thePicture)); KillPicture(thePicture); end. This is probably the simplest program possible which puts anything into the clipboard, but it does not work with MultiFinder. It DOES work will all other systems that I tried it on, including System 4.2 running without the MultiFinder. Tracing through the program under MultiFinder with LSP (a risky proposition, admittedly) revealed that the clipboard routines did not report an error. In fact, the clipboard was updated inside LSP, but once I quit back to the Finder, the clipboard reverted to its old state. Is this my error or some devious bug? Bill Lipa -------
lsr@apple.UUCP (Larry Rosenstein) (12/02/87)
In article <12355088678.214.P.PRIAPUS@HAMLET.STANFORD.EDU> P.PRIAPUS@HAMLET.STANFORD.EDU (Bill Lipa) writes: >Here is a small Lightspeed Pascal program which demonstrates the problems I am >having getting MultiFinder to recognize that I have changed the contents of the >clipboard: > I think Tech Note 180 has the answer. It says: "Multifinder 1.0 keeps separate scrap variables for each partition. Multifinder only checks to see whether or not to increment the other partition' scrapCounts in response to a user-initiated Cut or Copy. To do this it watches the SystemEdit call to determine whether an official Cut or Copy has been issued." This means that your picture is going into the clipboard, but Multifinder is not telling the other applications about it. I think the solution would be to call SystemEdit with a parameter of 3 (=Copy); as long as your application window is frontmost, SystemEdit will return FALSE (it won't tell a DA to do the Copy), but Multifinder will think that a Copy has been done. I don't have any documentation that indicates whether this is the "right" thing to do. I thought that I had read something about this, but now I can't find the reference. -- Larry Rosenstein Object Specialist Apple Computer AppleLink: Rosenstein1 UUCP: {sun, voder, nsc, mtxinu, dual}!apple!lsr CSNET: lsr@Apple.com
goldman@apple.UUCP (Phil Goldman) (12/02/87)
In article <6875@apple.UUCP> lsr@apple.UUCP (Larry Rosenstein) writes: >This means that your picture is going into the clipboard, but Multifinder is >not telling the other applications about it. > >I think the solution would be to call SystemEdit with a parameter of 3 >(=Copy); as long as your application window is frontmost, SystemEdit will >return FALSE (it won't tell a DA to do the Copy), but Multifinder will think >that a Copy has been done. > >I don't have any documentation that indicates whether this is the "right" >thing to do. I thought that I had read something about this, but now I >can't find the reference. > Unfortunately, there really is no clean way to do this right now. Calling _SysEdit as explained above will work, but a safer way is to call _MenuKey(cmd-C), assuming of course that your app has an Edit menu with cut, copy, etc. items. This way you don't have to worry about any possible side effects on DAs. The reason all this is necessary is that it was determined that copying large handles from application to application during layer switches caused too great a performance hit. Therefore, the clipboard is only copied when MF senses that the user has changed it. We realize that this causes a problem for application-generated changes and we hope to provide a standardized method for doing so in the future. -Phil Goldman Apple Computer