• 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 an drop in a custom NSView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drag an drop in a custom NSView


  • Subject: Re: Drag an drop in a custom NSView
  • From: Development <email@hidden>
  • Date: Tue, 9 Oct 2007 18:17:24 -0700

All right, I suppose that my question was poorly asked, mostly because as near as I can tell I don't know what to ask. I'm still struggling with that part.

However, with the information from the responses I have gotten I have made number of changes to the code in question. It will require many more. BUT I have managed to get it to drag if I use the mouseDown: method in the subclass. The problem is, I don't want it to start with a simple mouse down.

Here is the code as I am attempting to use it: (This is within my NSView subclass)

- (void)mouseDragged:(NSEvent *)theEvent
{
NSLog(@"Dragged");
NSPasteboard *pBoard = [NSPasteboard pasteboardWithName:NSDragPboard];
[pBoard declareTypes:[NSArray arrayWithObject:NSTIFFPboardType] owner:self];
[pBoard setData:[imageToThumb TIFFRepresentation] forType:NSTIFFPboardType];

NSSize offset = NSMakeSize(0.0,0.0);
NSRect location = [self frame];
[self dragImage:imageToThumb at:[self bounds].origin
offset:offset event:theEvent pasteboard:pBoard
source:self slideBack:YES];
}


This code does not work. Nothing happens when I click on the item and drag. If i change it to mouseDown: then it works. But I don't want that to be the case. When this problem is solved I will implement code to have the view perform a predefined function when it is clicked like a button. (Should I just make a subclass of NSButton for this instead?)
_______________________________________________


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


References: 
 >Drag an drop in a custom NSView (From: Development <email@hidden>)
 >Re: Drag an drop in a custom NSView (From: "I. Savant" <email@hidden>)

  • Prev by Date: Re: Getting Carbon Volume Mount Events in a Cocoa (Core Foundation) process
  • Next by Date: Re: Convert NSOpenGLView pixel coordinates to OpenGL world coordinates
  • Previous by thread: Re: Drag an drop in a custom NSView
  • Next by thread: Re: Drag an drop in a custom NSView
  • Index(es):
    • Date
    • Thread