Re: How to support dictionary service in a custom text view?
Re: How to support dictionary service in a custom text view?
- Subject: Re: How to support dictionary service in a custom text view?
- From: Evan Gross <email@hidden>
- Date: Mon, 07 Jul 2008 22:48:09 -0400
- Thread-topic: How to support dictionary service in a custom text view?
On 03/07/08 3:26 PM, "Charles Srstka" <email@hidden> wrote:
> 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
>
>
While supporting AX is always a good thing to do, the Dictionary service
doesn't require access to be enabled. Have you tested at all with
accessibility off?
My product (well, the new version I'm working on) makes heavy use of the
same TSM and AX APIs that the Dictionary service uses (and a few other). I'd
be very interested to see a custom NSView that's not derived from NSTextView
that supports these APIs (to know that someone has done it!).
Feel free to contact me off-list if this interests you as well...
Thanks,
Evan Gross
--
Evan Gross, President, Rainmaker Research Inc.
Developers of Macintosh and Windows Software
Spell Catcher for Mac OS and Windows
http://www.rainmakerinc.com/
_______________________________________________
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