• 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
drag and drop images to NSWindow doesn't work
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

drag and drop images to NSWindow doesn't work


  • Subject: drag and drop images to NSWindow doesn't work
  • From: "Bill So" <email@hidden>
  • Date: Tue, 25 Sep 2007 01:43:19 +0800

Dear all,

I m trying the drag n drop behavior of NSWindow using the following excerpt:

- (void)awakeFromNib {

	NSArray *myAy = [NSImage imagePasteboardTypes];

	[window registerForDraggedTypes:myAy];

	//[window registerForDraggedTypes:[NSArray
arrayWithObjects:NSFilenamesPboardType, NSURLPboardType, nil]];
}

- (NSDragOperation)draggingEntered:(id < NSDraggingInfo >)sender {
	NSLog(@"Hello");
}

- (void)draggingExited:(id < NSDraggingInfo >)sender {
	NSLog(@"dragging exit");
}

- (BOOL)prepareForDragOperation:(id < NSDraggingInfo >)sender {
	//check to see if we can accept the data
    return [NSImage canInitWithPasteboard: [sender draggingPasteboard]];
}

- (BOOL)performDragOperation:(id < NSDraggingInfo >)sender {
	// add the image to the source image array
	// render layout
	NSLog(@"Performing drag operation");
	return YES;
}

However, if I use the image pasteboard types, the sample app doesn't
respond to any image dragging into the window.

If I use the commented code in "awakeFromNib" instead, it prints those
debug message.

What's wrong?

Please kindly help.

Best Regards,
Bill
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: drag and drop images to NSWindow doesn't work
      • From: Charles Steinman <email@hidden>
    • Re: drag and drop images to NSWindow doesn't work
      • From: Fritz Anderson <email@hidden>
    • Re: drag and drop images to NSWindow doesn't work
      • From: Dominik Pich <email@hidden>
  • Prev by Date: Re: NSMutableArray + NSEnumerator = No Memory
  • Next by Date: Instantiate custom NSWindow
  • Previous by thread: Re: Issue with getting availableData from NSFileHandle on Intel Mac.
  • Next by thread: Re: drag and drop images to NSWindow doesn't work
  • Index(es):
    • Date
    • Thread