• 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: Using NSTextView's delegate method textView:draggedCell:inRect:event:atIndex: selectively
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using NSTextView's delegate method textView:draggedCell:inRect:event:atIndex: selectively


  • Subject: Re: Using NSTextView's delegate method textView:draggedCell:inRect:event:atIndex: selectively
  • From: Douglas Davidson <email@hidden>
  • Date: Thu, 1 Mar 2007 16:46:04 -0800


On Mar 1, 2007, at 4:27 PM, Philip Dow wrote:

This is what I've been doing. However, it does not give me control over the dragged image, which is something I woud like to customize when writing my own pasteboard data.

If that's all you want, you can just override dragImageForSelectionWithEvent:origin:.


I have tried overwriting textView:draggedCell:inRect:event:atIndex: , and it works fine when I'm working with my custom data. However, whenever I don't want to handle the drag, preferring to use the default implementation, I must still manually code that default implementation. There is no super method to call here.

What NSTextView does here can be summarized as (a) set the selected range to {index, 1} and (b) call dragSelectionWithEvent:event offset:NSZeroSize slideback:YES.


Try as I might, I cannot get the same behavior as the default implementation. I'm having a heck of a time putting the data on the pasteboard in the right way so that the drag's receivers behave as they would if I had never implemented this delegate method in the first place.

Getting the data on the pastebaord is just writeSelectionToPasteboard: [NSPasteboard pasteboardWithName:NSDragPboard] types:[textView writablePasteboardTypes], but there are other things that are done in dragSelectionWithEvent:offset:slideBack: that you cannot readily simulate. You should just call it instead.


Douglas Davidson

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: Using NSTextView's delegate method textView:draggedCell:inRect:event:atIndex: selectively
      • From: Philip Dow <email@hidden>
References: 
 >Using NSTextView's delegate method textView:draggedCell:inRect:event:atIndex: selectively (From: Philip Dow <email@hidden>)

  • Prev by Date: Using NSTextView's delegate method textView:draggedCell:inRect:event:atIndex: selectively
  • Next by Date: Re: Preventing application from becoming active (urgently needed)
  • Previous by thread: Using NSTextView's delegate method textView:draggedCell:inRect:event:atIndex: selectively
  • Next by thread: Re: Using NSTextView's delegate method textView:draggedCell:inRect:event:atIndex: selectively
  • Index(es):
    • Date
    • Thread