Subject: Re: Converting a LDragTask to Cocoa's dragImage




On Mar 26, 2009, at 1:19 PM, Eric Gorr wrote:

I have a old LDragTask that looks like:

LDragTask drag( ..., ..., ..., kMyDragType, &data, sizeof(DataType*), flavorNotSaved );

Eventually,

GetFlavorType(inDragRef, inItemRef, 1, &flType);

is called and flType is assigned the value of kMyDragType.


The question is how do I setup the pasteboard that is passed with dragImage so that GetFlavorType will be able to extract the correctly flavorType?

I thought something like this might work:

NSPasteboard *dragData
NSString *dragType = NSFileTypeForHFSTypeCode( 'Drg1' );

[dragData declareTypes:[NSArray arrayWithObject:dragType] owner:self];
[dragData setData:[NSData dataWithBytes:&item length:sizeof( item )] forType:dragType];

but, GetFlavorType does not reliably assign 'Drg1' to flType...what's weird is that it works every once in awhile, but fails most of the time. I figure that when it was working, I was just getting lucky.

Slight correction...I don't believe this was ever working.

If anyone is aware of any documents which discuss taking some old drag manager code and convert it to COCOA, I am interested.

For the moment, COCOA will handle the source side...the destination code will remain in Carbon for now.



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@xxxxxxxxxxxxxxx)

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/maillists%40codeha.us

This email sent to maillists@xxxxxxxxx

...



Privacy