• 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 out
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drag out


  • Subject: Re: Drag out
  • From: Jörn Salewski <email@hidden>
  • Date: Thu, 09 Oct 2003 18:40:29 +0200

am 09.10.2003 6:16 Uhr schrieb Nikolay Ilduganov unter email@hidden:


> I don't believe that nobody here knows how to do that.
>

Maybe I do.

I did it for an NSOutlineView. Shouldn't be any difference for a table view.
I subclassed the outline view with the followig code:

- (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint
operation:(NSDragOperation)operation {

NSPoint mousePoint = [NSEvent mouseLocation];
NSPoint winPoint = [[self window] convertScreenToBase:mousePoint];
NSPoint viewPoint = [self convertPoint:winPoint fromView:nil];

// if the drag session ended in the same outline view
// do nothing
if (NSMouseInRect(viewPoint, [self visibleRect], [self isFlipped])) {

}

// the drag ended outside the view
else {
if( [[self dataSource] respondsToSelector: @selector(removeEntry:)]) {

// code for sound and a poof animation

// iterating through dragged items and removing them from
// the data source

NSEnumerator *enumerator = [[[self dataSource] draggedEntries]
objectEnumerator];
id entry;
while (entry = [enumerator nextObject]) {
[[self dataSource] removeEntry:entry];
}

// update GUI
[self reloadData];
}
}
}

Hope it helps.

Chears,

Joern
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Drag out
      • From: Nikolay Ilduganov <email@hidden>
References: 
 >Re: Drag out (From: Nikolay Ilduganov <email@hidden>)

  • Prev by Date: Re: receiving all network traffic for a process?
  • Next by Date: Re: Creator code and file extension
  • Previous by thread: Re: Drag out
  • Next by thread: Re: Drag out
  • Index(es):
    • Date
    • Thread