• 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 to Nowhere and Disappearing Smoke
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drag to Nowhere and Disappearing Smoke


  • Subject: Re: Drag to Nowhere and Disappearing Smoke
  • From: Robert Cerny <email@hidden>
  • Date: Tue, 6 Sep 2005 12:02:53 +0200

Hi,
subclass the NSTableView and implement following method

- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)flag
{
    return NSDragOperationDelete;
}

- (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation
{
if ( !NSMouseInRect([[self window] convertScreenToBase:aPoint], [self bounds], NO) ) //is outside views bounds
{
NSShowAnimationEffect(NSAnimationEffectDisappearingItemDefault,
aPoint, NSZeroSize, nil, nil, nil);


        [[self dataSource] deleteIndexes:[self selectedRowIndexes]];
    }
}


HTH Robert

On 6.9.2005, at 11:50, Philip Dow wrote:

NSShowAnimationEffect() displays a system animation at a given point in screen coordinates. The effect is used to indicate that an item has been removed from a list without actually deleting the underlying data. An example is dragging an item out of the far left list in a finder window. As you drag, the cursor changes to show the disappearing smoke, and when you let go the system runs the smoke animation. That let's you know you're removing the item from the list without deleting the item itself.

I would like to implement this effect to remove an item from a table without deleting it. I can call the cocoa function no problems. What I'm running up against is catching the drag to nowhere. On the one hand, I'd like to know a drag is going on so that I can change the cursor, on the other I need to know when the drag is finished and, by the criterion of a normal drag, rejected, so that I can show the effect and operate on my data. I figure if the finder can do this, I can get pretty close.

I could catch mouseUp: in my window controller, but then how would I know a drag is involved? Or I could implement drag in my window and handle drops out of my tables in this special way. In either case, I cannot accomplish what the finder can. When dragging out of that far left list, you can drag to anywhere, window or not, to remove the item.

Has anyone had any experience trying something like this, or does anyone know of any online articles or examples?

-Phil

http:phildow.net

_______________________________________________
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


_______________________________________________ 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: 
 >Calling AppleScript from a Cocoa app (From: Phil <email@hidden>)
 >Re: Calling AppleScript from a Cocoa app (From: "email@hidden" <email@hidden>)
 >Re: Calling AppleScript from a Cocoa app (From: Phil <email@hidden>)
 >Re: Calling AppleScript from a Cocoa app (From: "email@hidden" <email@hidden>)
 >Drag to Nowhere and Disappearing Smoke (From: Philip Dow <email@hidden>)

  • Prev by Date: Drag to Nowhere and Disappearing Smoke
  • Next by Date: NSTableView: serious flaw when it comes to text edition?
  • Previous by thread: Drag to Nowhere and Disappearing Smoke
  • Next by thread: Re: Calling AppleScript from a Cocoa app
  • Index(es):
    • Date
    • Thread