Documentation Archive Developer
Search

Why is my Control/HIView not accepting drops on Mac OS X v10.4 (Tiger)?

Q: Why is my Control/HIView not accepting drops on Mac OS X v10.4 (Tiger)?

A: The documentation for kEventControlDragEnter at kEventControlDragEnter specifies that:

"Sent when a drag item enters a view\x92s bounds. If you want to respond to the drag, your drag entered handler must return noErr If you return eventNotHandledErr then you will not receive further drag events, nor will you be able to receive the drag item."

and the Discussion for that event in CarbonEvents.h adds that:

"If you at all wish to handle the drag, you must return true in the kEventParamControlWouldAcceptDrop parameter from your event handler in response to this event. If you return eventNotHandledErr, do not supply a kEventParamControlWouldAcceptDrop parameter, or set its value to false, you will not receive 'within' or 'leave' messages, nor will you be eligible to receive the drop. This is done to try to be as efficient as possible when sending events during the drag operation."

Actually, on Mac OS X v10.2 when this event was introduced, and later on Mac OS X v10.3, you could still receive the kEventControlDragWithin, kEventControlDragLeave, and kEventControlDragReceive events if you returned eventNotHandledErr from your kEventControlDragEnter handler, or did not provide the kEventParamControlWouldAcceptDrop parameter or set it to false.

This bug has been fixed in Mac OS X v10.4 and everything now works as documented. This means that if you did not handle correctly the kEventControlDragEnter event, you will no longer receive the other 3 events on Mac OS X v10.4 whereas you were receiving them in Mac OS X v10.2 and v10.3; in other words, your control will no longer accept drops.

Writing your kEventControlDragEnter handler according to documentation will ensure that your drag-and-drop operation will be successful on all versions of Mac OS X.

Document Revision History

DateNotes
2005-04-29Explains how to handle correctly the kEventControlDragEnter event so drops will work in a Control or HIView.