PDA

View Full Version : Any cocoa experts? I have a quick question




whiteangel
Sep 30, 2004, 09:30 AM
I wish to write a program that will return me the word underneath the mouse when the mouse stops. the thing is this program won't have an interface it'll just run and not be active application.

for starters, i could try to make it work with safari only first. my hope to be able to get the word the mouse is over in any application the user is using.

can this be done? and how?

I'm still in the process of learning cocoa.

[in case my question over complicated stuff. I wish to write a program that when you stop your mouse over a word (in any application) a small box with the definition of the word will pop-up.]



GeeYouEye
Oct 3, 2004, 10:49 PM
There's an easy way to do it, a somewhat hard way to do it, and a hard way to do it. The easy way is to write an application which will install a service which any Cocoa and some Carbon applications can access. You'll have to select the word and hit a key combination to use it, and it will open the actual application which will then diplay the definition. I believe there are already applications that do this.

The more difficult way to do it would be to write a conetextual menu plug-in. Then the uiser could simply right-click thw word and scroll to a submenu containing the definiton. This solution would have the largest convenience to development difficulty ratio, though there may be a significant impact in performance depending on how definitions are retrieved.

The hard way is to do it exactly as you described it. This would likely involve a text-services haxie. It will be quite difficult and subject to Aplle breaking it with any OS update.