Re: Reading word at mouse pointer w/o Universal Access
Re: Reading word at mouse pointer w/o Universal Access
- Subject: Re: Reading word at mouse pointer w/o Universal Access
- From: Evan Gross <email@hidden>
- Date: Mon, 03 Mar 2008 06:27:42 -0500
- Thread-topic: Reading word at mouse pointer w/o Universal Access
On 28/02/08 8:27 PM, "Ryan Homer" <email@hidden> wrote:
> I've read this post
> (http://lists.apple.com/archives/accessibility-dev/2006/Aug/msg00007.html
> ) about using the accessibility options to read the text under the
> cursor. However, this requires that the user enable access for
> assistive devices in System Preferences. The application must
> therefore check for that. It also seems quite complicated; I don't
> want to have to deal with glyphs and the like - I only want the text
> under the cursor, full stop.
>
> The Dictionary application is able to read a word under the cursor
> without enabling access for assistive devices.
>
> Does anyone therefore know of an alternative way to do this?
>
> Thanks in advance.
>
The Dictionary panel is a special kind of input method component:
/System/Library/Components/DictionaryService.component
It uses various techniques to obtain the text from the application (Text
Service Manager and TSM Document Access CarbonEvents, along with
Accessibility APIs).
If Accessibility is off, and your app isn't a trusted one, TSM (and
presumably the Leopard IMKit equivalents) is the only reliable way to get
the text at any screen location. Many apps support this, there are still
quite a few that don't. There are some that support one, but not the other.
Best to try TSM first, then if no luck try AX.
If you take a close look, the Dictionary panel will also try to get the font
and style information, and display the word(s) being defined with their
actual attributes. Again, some apps support this via TSM, AX, or even both,
the majority of apps don't. All the Mac OS X editing views (NSTextView,
MLTE/HITextView, editable WebKit views) support both - perhaps not
perfectly, but well enough.
If your requirements are that this must work anywhere, with any app, forget
it. Try to get the Dictionary popup to do anything in MS Word, for
example...
Hope that helps,
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