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: Charles Srstka <email@hidden>
- Date: Mon, 7 Jul 2008 23:16:18 -0500
On Jul 7, 2008, at 10:57 PM, Evan Gross wrote:
On 07/07/08 11:14 PM, "Charles Srstka" <email@hidden>
wrote:
I'm not sure what you're referring to with regards to
"accessibility off". If
you are referring to the "Allow access for assistive devices"
check box in
the Universal Access preference pane, that isn't what I was
talking about at
all.
That is what I was talking about. The Dictionary service will work
if "Allow
access for assistive devices" is deselected (off).
Yes, but I think this check box is not relevant to this functionality.
At any rate, my accessibility methods get called when I type command-
control-D, whether the check box is turned on or not. If I comment out
my Accessibility support, the dictionary service fails to work whether
the check box is on or not.
My understanding is that the check box only enables certain advanced
parts of the Accessibility API which allow the user to manipulate the
UI. The basic accessibility stuff, just to read the screen and such,
doesn't require that check box to be on. I think that VoiceOver uses
the Accessibility API to read text on the screen, and it doesn't need
that check box to be enabled in order to work.
What I did was implement the methods in the NSAccessibility informal
protocol such as accessibilityAttributeNames,
accessibilityAttributeValue:,
accessibilityAttributeValue:forParameter:, and the rest.
Implementing these
after having implemented NSTextInput caused the Dictionary service
to start
working with my custom view.
Sure, but when "Allow access for assistive devices" is deselected,
those
methods will (should!) not be called.
Apparently this is wrong, because they do.
I know that the Dictionary service *does* apparently make use of the
accessibility APIs, as if I set a breakpoint in the accessibility
methods,
they get called quite a bit when one invokes the Dictionary
service via
command-control-D with the mouse cursor over my view.
Sure, it uses (possibly requires) NSTextInput (TSM & document access
events)
support, and (optionally) accessibility to do it's thing. If
accessibility
isn't available ("Allow access for assistive devices" deselected, or
the
app/editing view doesn't support access to text via accessibility),
the
Dictionary service will work using only NSTextInput.
See what happens if you deselect "Allow access for assistive
devices" - as
long as your NSTextInput implementation is complete (enough for the
Dictionary service, anyway), it should still work.
It doesn't unless my Accessibility code is there.
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