Re: UIElement references duration of validity?
Re: UIElement references duration of validity?
- Subject: Re: UIElement references duration of validity?
- From: Larry Gerndt <email@hidden>
- Date: Mon, 01 Dec 2003 20:50:28 -0800
>
> I'm using the Accessibility API, following the example in the sample
>
> code
>
> called UI Element Inspector, and I've got a question. Here's what I'm
>
> trying to do, in psuedo code:
>
>
>
> AXUIElementCopyElementAtPosition(...&curElement);
>
> MyGetParentWindow(curElement, &parentElement);
>
> CFRetain(parentElement);
>
>
Depending on how MyGetParentWindow works you probably do not need to
>
CFRetain the parentElement. All the calls to AX give you back a
>
"retained" value.
Yes, I realized that later, but good of you to point it out too.
>
> .
>
> . // overlay window appears over the parent at this point, then
>
> later...
>
> .
>
> AXUIElementPerformAction(parentElement, kAXRaiseAction));
>
>
>
> // error, return -25202 (invalid element)
>
>
What application is returning this error? Is it a carbon or Cocoa app.
It's a Carbon app.
>
> Does anyone know why this fails?
>
>
>
> In case it helps, MyGetParentWindow() traverses up the UIElement
>
> hierarchy
>
> until it finds an element whose role is "kAXWindow", and I know this
>
> works
>
> because I'm able to get the bounds of that window successfully).
>
>
>
> I've also noticed that each time the mouse moves, the references
>
> returned
>
> from the Accessibility API are always different from their former
>
> values.
>
> This leads me to believe that all of the references become invalidated
>
> the
>
> moment the mouse moves. Is that true?
>
>
No that is not true. Every time you ask the AX api for an
>
AXUIElementRef you get back a new pointer value. CFEqual on these
>
elements will show you that they are equivalent refs, point to the same
>
thing. Does that make sense?
Ah, yes it does. That sheds a lot of light on that issue, thanks. Of
course I'm still somewhat baffled by why the previous reference doesn't
work, but I think you're saying it should still be valid, correct?
--
Larry Gerndt
AIM Handle: SonOfTheSonOfMan
Let the truth be told though the heavens fall -- James Garrison
_______________________________________________
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.