On Dec 19, 2011, at 9:10 PM, 王珺翔 <wangu...@gmail.com> wrote:

> I have a cocoa application running and there is a NSButton on it. From
> another process, I can get properties like "position", "title" via Mac
> Accessibility. However, other properties like "button style", "font" cannot
> be retrieved in that way. So, Is there any cocoa functions or  MacOS APIs
> that can retrieve properties of a UI element, in an cross-process way ?

If I'm correct in assuming you want to ask about the button style and font of 
individual controls in another app, rather than (say) asking Interface Builder 
what font and button style have been assigned to an object on a canvas, then 
no, there is no way to do this because as far as the system is concerned these 
are nonsensical questions to ask.

An app's windows are a black box as far as the system is concerned—the app 
draws whatever content it wants into the window's backing store, and receives 
mouse and keyboard events in the window. The concept of views exists entirely 
within the Cocoa framework. Things like "button style" and "font" only make 
sense when configuring NSViews, and Cocoa takes care of dispatching mouse and 
keyboard events to the appropriate NSResponder.

Because these are visual APIs rather than semantic information, they are not 
exposed via the accessibility API. So there is no way to accomplish what you're 
after.

--Kyle Sluder_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to