Skip navigation.
 
mlHow to support dictionary service in a custom text view?
FROM : Charles Srstka
DATE : Thu Jul 03 19:03:31 2008

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

Related mailsAuthorDate
mlHow to support dictionary service in a custom text view? Charles Srstka Jul 3, 19:03
mlRe: How to support dictionary service in a custom text view? Charles Srstka Jul 3, 21:26
mlRe: How to support dictionary service in a custom text view? Evan Gross Jul 8, 04:48
mlRe: How to support dictionary service in a custom text view? Charles Srstka Jul 8, 05:14
mlRe: How to support dictionary service in a custom text view? Evan Gross Jul 8, 05:57
mlRe: How to support dictionary service in a custom text view? Charles Srstka Jul 8, 06:16
mlRe: How to support dictionary service in a custom text view? Evan Gross Jul 8, 09:06
mlRe: How to support dictionary service in a custom text view? Charles Srstka Jul 9, 02:39