NSTextView attachments and context menus
NSTextView attachments and context menus
- Subject: NSTextView attachments and context menus
- From: Martin Hewitson <email@hidden>
- Date: Tue, 9 Mar 2010 07:55:40 +0100
Dear list,
I have an NSTextView which support dragging files in, either to create a link to the file, or to add the file as an attachment. So far so good.
Now I want to offer the user a context menu to perform operations on the attachment (open, save, etc). So far I was unable to find a way to intercept a 'right-click' on the nstextview to offer a custom context menu. What I did get working is the single left-click version by implementing textView:clickedOnCell:inRect:atIndex: in the text view's delegate. In that method I create a context menu and show it at the mouse location using NSMenu's popUpContextMenu:withEvent:forView:. That works, but with one problem. The context menu that appears has two additional menu items: "Import Image" and "Capture Selection from Screen". So I have three questions:
1) Is there a better way to achieve what I want?
2) Where do these additional menu items come from? Are they services?
3) How could I do this with a right-click instead of a single-click?
I have another question about attachments, but I'll post that separately.
Thanking you in advance,
Martin
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer
Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: email@hidden
WWW: http://www.aei.mpg.de/~hewitson
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_______________________________________________
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