NSDragPboard is the name of a pasteboard, not the dragged type. The drag type
is the type of data you put on the pasteboard to drag. For example, is you are
dragging a URL, then register for kUTTypeURL. If it's private data then it's
along these lines:
NSString *myType =
UTTypeCreatePreferredIdentifierForTag(kUTTagClassNSPboardType,
CFSTR("privateDat", kUTTypeData); // You are using UTIs right?
-(id)init.... {
...
[self registerForDraggedTypes:[NSArray arrayWithObjects:myType, nil]];
...
}
-(void)mouseDown:(NSEvent*)event {
...
[pboard clearContents];
NSPasteboardItem *item = [[[NSPasteboardItem alloc] init] autorelease];
[item setData:data forType:myType];
[pboard writeObjects:[NSArray arrayWithObject:item]];
// start drag
...
}
-raleigh
On Sep 19, 2010, at 7:43 PM, [email protected] wrote:
> Sorry ... I did not say I had done that as follows:
>
> [self registerForDraggedTypes:[NSArray
> arrayWithObjects:NSDragPboard, nil]];
>
>
>
> On Sep 19, 2010, at 7:19 PM, Raleigh Ledet wrote:
>
>> You need to register as a dragging destination for your dragging type:
>> -registerForDraggedTypes:
>>
>> http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html%23//apple_ref/occ/instm/NSView/registerForDraggedTypes:
>>
>> -raleigh
>>
>> On Sep 19, 2010, at 5:08 PM, [email protected] wrote:
>>
>>> I do
>>>
>>> dragImage:at:offset:event:pasteboard:source:slideBack:
>>>
>>> in a view's mouseDragged method.
>>>
>>> The view also implements all the correct methods for dragging as outlined
>>> in the example Erik Buck referred to. These dragging methods are never
>>> called. So what must be done to Drop in the view that originates the Drag?
>>>
>>> It this possible?
>>>
>>> -koko
>>>
>>>
>>>
>>> _______________________________________________
>>>
>>> Cocoa-dev mailing list ([email protected])
>>>
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>>
>>> Help/Unsubscribe/Update your Subscription:
>>> http://lists.apple.com/mailman/options/cocoa-dev/ledet%40apple.com
>>>
>>> This email sent to [email protected]
>>
>>
>
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]