• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Dock freezes when dragging file over it
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Dock freezes when dragging file over it


  • Subject: Dock freezes when dragging file over it
  • From: Tjark Derlien <email@hidden>
  • Date: Fri, 7 Apr 2006 10:46:18 +0200

My application shows a list of files in an outline view. I would like to implement the view as a dragging source so the user is able to drag files from the view to the dock (to open the file with an application or move it to the trash).

My model class (which represents a single file or folder) has two methods to support NSPastebaord:
- (void) writeToPasteboard: (NSPasteboard*) pboard
{
NSMutableArray *types = [NSArray arrayWithObjects: NSFilenamesPboardType, NSStringPboardType, nil];
[pboard declareTypes:types owner:self];
}


- (void)pasteboard:(NSPasteboard *)pboard provideDataForType: (NSString *)type
{
if ([type isEqualToString:NSFilenamesPboardType])
{
NSArray* pathsArray = [NSArray arrayWithObject: [self path]];
[pboard setPropertyList:pathsArray forType:NSFilenamesPboardType];
}
else if ([type isEqualToString:NSStringPboardType])
{
[pboard setString:[self path] forType:NSStringPboardType];
}
else
/*unsupported type requested*/;
}


In my outline view's controller class, the implementation is simple:
- (BOOL) outlineView: (NSOutlineView *) outlineView
writeItems: (NSArray*) items
toPasteboard: (NSPasteboard*) pboard
{
id item = [items objectAtIndex: 0]; //only single selection is currently supported
[item writeToPasteboard: pboard];
}


Now the problem: If I drag a file from the view onto the Dock, the Dock freezes after 1-3 seconds while dragging around in the Dock's area. My model's "- (void)pasteboard: provideDataForType:" selector is called multiple times with both pasteboard types (the calls to that selector do return - and the model object exists all the time).

It is strange that if I provide the NSFilenamesPboardType data immediately (just after declaring the supported types), the Dock does not hang.
- (void) writeToPasteboard: (NSPasteboard*) pboard
{
NSMutableArray *types = [NSArray arrayWithObjects: NSFilenamesPboardType, NSStringPboardType, nil];
[pboard declareTypes:types owner:self];
[self pasteboard: pboard provideDataForType: NSFilenamesPboardType];
}
As expected, the "- (void)pasteboard: provideDataForType:" selector gets later (during the dragging) called only with NSStringPboardType.


(Before you ask why deferring the data providing just for a simple path string: In the real code I declare a lot more types like NSFileContentsPboardType, NSTIFFPboardType, but the problem also occurs when only declaring just the two mentioned types).

Does anyone has a explanation for this problem?

By the way, the problem occurs on both Mac OS X 10.4.4 and 10.4.6.

Thanks a lot,
Tjark
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: NSTextField & setPlaceHolderString
  • Next by Date: select a window
  • Previous by thread: Re: NSTextField & setPlaceHolderString
  • Next by thread: select a window
  • Index(es):
    • Date
    • Thread