Developers Corner


While using the NSDragging protocols, on Mach, views get properly updated between dragging events, while on NT they don't.


Actually, there doesn't appear to be an answer. This problem was posted to the mail lists, but there was no reply. To illustrate the problem, we developed the following DragDraw Example. This is a fairly good example of the two general ways in which to implement dragging & dropping.

The "External" draging methodology utilizes the NSDragging protocols (NSDraggingInfo, NSDraggingSource, and NSDraggingDestination). In this example, the EBShapeVendor & EBShapeControl provide examples of this type of interaction. The EBShapeVendor answers to the NSDraggingSource protocol, and allows the user to drag shapes out of itself, to be used in other controls. The EBShapeControl is both an NSDraggingSource and NSDraggingDestination. You can drag a shape from the EBShapeVendor and drop it on the EBShapeControl. You can also Shift-Drag a shape out of an EBShapeControl and drop it into the other EBShapeControl.

The "Internal" method, is when, within a given custom NSControl, you want to implement dragging, such that you will only ever want to drag within the custom control. In this example, the EBShapeControl also demonstrates this type of functionality. If you click and drag a shape within an EBShapeControl, it will drag around, but not be able to leave the view.

In the "External" drag methodology, the dragging is performed by the YellowBox, and responsibility for generating all events comes from YellowBox management. In the "Internal" drag methodology you form your own tight loop, polling the NSRunLoop to get events as they come in, determine their type, and act accordingly.

In this example, during both types of dragging, the relative position of the shape within the EBShapeControl is updated and displayed in the control.

On Mach, when using the "External" dragging methodology, and a shape is being dragged into an EBShapeControl, the updated position is always displayed in the view as the shape is dragged, before it is released.

However, on Windows NT using YellowBox, the position updates are never displayed. We found that this did not work on OS4.2 vs. WOF3.5.1 and WOF4.0 versions of YellowBox. IF ANYONE HAS A SOLUTION FOR THIS IT WOULD BE APPRECIATED VERY MUCH. Please email suggestions to

[ Developers Corner| Home| Products| Ordering| Support| Trademarks ]

Objective Technologies Inc.
90-07 68th Ave., Forest Hills, NY 11375
email: voice: 718.997.9741
Developers Corner: Drag Draw - Copyright © 1995-2008 Objective Technologies, Inc. ® All rights reserved.

NOTE: OTI does not warrant, guarantee, or otherwise assume any responsibility or accountability for any loss or corruption caused by any of the software or suggestions mentioned or available on this page. If something bad happens as a result of using this software, it's your own fault for using it. Please report any problems to