Scrap Manager Q&As

Technote TB 560October 1990

Revised by: Developer Support Center September 1993
Written by: Developer Support Center October 1990

This Technical Note contains a collection of archived Q&As relating to a specific topic--questions sent the Developer Support Center (DSC) along with answers from the DSC engineers. Current Q&A's can be found on the Macintosh Technical Q&A's web site.

When to call GetScrap in a Desk Accessory

Date Written: 3/9/92

Last reviewed: 6/14/93

We're having problems with the GetScrap function in our desk accessory. After a user opens our DA, when we call GetScrap to get any text from the Clipboard, GetScrap returns -102 (no requested type in scrap). After once (or more?) through the event or SystemTask loop, the scrap suddenly shows up. What's causing this?


The reason for the trouble you're having with desk accessories and GetScrap is that you're looking for the converted scrap at the wrong time in the process. According to the MultiFinder documentation (Programmer's Guide to MultiFinder and Inside Macintosh Volume VI), an application is supposed to convert its private scrap and write it to the public scrap when it receives a suspend event. When the system opens your DA, it immediately sends it an Open message; the application hasn't received its suspend event yet. You have to wait until the scrap has been converted. This, for a DA, should occur at the first null event, and for applications, when you get a resume event.

Clipboard window should be hidden in MultiFinder

Date Written: 11/21/89

Last reviewed: 12/17/90

I think my application is completely MultiFinder-aware and conforms to all the MultiFinder guidelines. What might I have missed?


Many developers forget one important MultiFinder feature--there is a note on page 3-3 of the "Programmer's Guide to MultiFinder" which many programmers seem to miss: "Applications should hide their Clipboard window when not running in the foreground. The contents of the Clipboard are not valid unless the application is frontmost." This means you must do more than just deactivate the Clipboard. Make it invisible--otherwise there can be multiple incarnations of the Clipboard window displayed on the screen at the same time, only one of which is necessarily current.

Previous Technote | Contents | Next Technote