How to support dictionary service in a custom text view?
How to support dictionary service in a custom text view?
- Subject: How to support dictionary service in a custom text view?
- From: Charles Srstka <email@hidden>
- Date: Thu, 3 Jul 2008 12:03:31 -0500
Okay, so I've got a custom text view that's a subclass of NSView (not
NSTextView). I've followed the instructions on this page:
http://developer.apple.com/documentation/Cocoa/Conceptual/InputManager/Tasks/TextViewTask.html#/
/apple_ref/doc/uid/20001040
I override acceptsFirstResponder to return YES, I override keyDown: to
call interpretKeyEvents:, and I've implemented the NSTextInput
protocol. I override all the mouse events and send those to the
current input manager if it wants them (it never does). I even told
the NSWindow to accept mouseMoved: events so I could forward them if
the input manager wanted them (it doesn't). I've also implemented
Services support, accepting NSStringPboardType data and providing it
to services.
Anyway, this all works great for the most part. Text editing works
fine, services work fine, everyone's happy, except for one thing - I
want that dictionary widget that NSTextView has when you type command-
control-D with the mouse hovering over a word. Since this is a system
service and seems to get loaded into every Cocoa app, there must be a
simple way to get my view to support it, but I'm drawing a blank as to
what it is. I'm sure it's something simple, I'm just not sure what's
the remaining piece of the puzzle that I need to implement. Anyone
know what I'm forgetting?
Thanks,
Charles
_______________________________________________
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