Re: Archiving or copying observers and elements
Re: Archiving or copying observers and elements
- Subject: Re: Archiving or copying observers and elements
- From: Mike Engber <email@hidden>
- Date: Thu, 12 Dec 2002 14:56:13 -0800
I think you're confusing the assistive app vs target app.
Besides, isn't copying an AXUIElementRef just a matter of getting the
HIObject and ID and putting them into a new AXUIElementRef? Am I
missing something?
I can assure that an AXUIElementRef referring to an element in a Cocoa
app does not contain an HIObject and ID.
AXUIElementRefs are opaque and are primarily an assistive app concept.
On the target app side - you do end up providing _things_ that have to
be returned, via accessibility, as AXUIElementRefs. In Carbon this is
done very directly using AXUIElementCreateWithHIObjectAndIdentifier. In
Cocoa you hand
off an NSObject and we take over from there - you never actually deal
with
AXUIElementRefs themselves.
This brings to mind an interesting point. Even though in the Carbon
world
you have fns like AXUIElementGetHIObject which allow you to pick apart
an
AXUIElementRef - those are only for use by target applications - code
that
makes your app accessibile.
You should not be using them in assistive apps. If you get an
AXUIElementRef
that's not from Carbon, these calls will return garbage or crash.
While I'm no expert with Mac accessibility (is anyone?) I've found that
caching AXUIElementRefs to be less than useful. It has been bad to
assume that an application will always give you the same AXUIElementRef
for a given HIObject. The app may just create a new one each time.
Since you (the assistive app) do not share the same address space with
your target app you never really get "the object" that the target app is
handing out. Whether or not the target app is creating a new object on
every request doesn't matter - you're always getting a newly allocated
copy in your own address space.
However, all AXUIElementRefs for a given user interface element should
be CFEqual (just not pointer equal). So, I don't understand your comment
about caching AXUIElementRefs to be less than useful.
-ME
_______________________________________________
accessibility-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/accessibility-dev
Do not post admin requests to the list. They will be ignored.