• 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
Re: drag and drop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: drag and drop


  • Subject: Re: drag and drop
  • From: David Kennedy <email@hidden>
  • Date: Tue, 7 Mar 2006 13:13:11 +0000

On 7 Mar 2006, at 12:10, Valerio Ferrucci wrote:
I followed the steps in "http://developer.apple.com/documentation/ Cocoa/Conceptual/DragandDrop/index.html".

In IB I put a CustomView in the window and set as CustomClass of the view "MyClass" (extending NSView).

Then I declared in "MyClass" the methods:

initWithFrame
draggingEntered
draggingExited
performDragOperation

but the last three methods are never called!

Am I forgetting something?

This is my initWithFrame method (I'm beginning with .mov files):

- (id)initWithFrame:(NSRect)frameRect
{
	if ((self = [super initWithFrame:frameRect]) != nil)
	{
		NSString *pboardType = NSCreateFileContentsPboardType(@"mov");
		NSArray *dragTypes = [NSArray arrayWithObject:pboardType];
		[self registerForDraggedTypes:dragTypes];
		highlight = NO;
	}
	return self;
}

The code, and the example are correct if you are dealing with a pasteboard that you know has file content data on it (e.g. your application has written it there).


But often (for efficiency) this is not the case.

For instance, when you drag files from the finder - the file content does not tend to be included. To handle this, you can use the "Dragging File Paths" example, then process the file paths (e.g. load the file's data) as required.

Hope this helps,
Dave

------
David Kennedy (http://www.zenopolis.com)

_______________________________________________
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


References: 
 >drag and drop (From: Valerio Ferrucci <email@hidden>)

  • Prev by Date: Re: Text like the window title of iPhoto 6 : how ?
  • Next by Date: Help in Text Disaplaying
  • Previous by thread: drag and drop
  • Next by thread: Copying a view from one nib to another
  • Index(es):
    • Date
    • Thread