FROM : Charles Srstka
DATE : Thu Jul 03 21:26:29 2008
On Jul 3, 2008, at 12:03 PM, Charles Srstka wrote:
> 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?
Never mind! I found the answer to my own question - I needed to
implement the NSAccessibility protocol. I've done that, and now it
works.
Charles
DATE : Thu Jul 03 21:26:29 2008
On Jul 3, 2008, at 12:03 PM, Charles Srstka wrote:
> 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?
Never mind! I found the answer to my own question - I needed to
implement the NSAccessibility protocol. I've done that, and now it
works.
Charles
| Related mails | Author | Date |
|---|---|---|
| Charles Srstka | Jul 3, 19:03 | |
| Charles Srstka | Jul 3, 21:26 | |
| Evan Gross | Jul 8, 04:48 | |
| Charles Srstka | Jul 8, 05:14 | |
| Evan Gross | Jul 8, 05:57 | |
| Charles Srstka | Jul 8, 06:16 | |
| Evan Gross | Jul 8, 09:06 | |
| Charles Srstka | Jul 9, 02:39 |






Cocoa mail archive

