• 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: Nikolay Ilduganov <email@hidden>
  • Date: Fri, 10 Oct 2003 01:00:38 +0700

I have already found this solution... But thank you anyway.

On Thursday, Oct 9, 2003, at 23:40 Asia/Novosibirsk, Jvrn Salewski wrote:

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.
_______________________________________________
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.

References: 
 >Re: Drag out (From: Jörn Salewski <email@hidden>)

  • Prev by Date: Loading an NSView instance from a Nib in a bundle
  • Next by Date: Re: Loading a TTF font
  • Previous by thread: Re: Drag out
  • Next by thread: Re: Drag out
  • Index(es):
    • Date
    • Thread