Re: UIElement references duration of validity?
Re: UIElement references duration of validity?
- Subject: Re: UIElement references duration of validity?
- From: Guy Fullerton <email@hidden>
- Date: Tue, 02 Dec 2003 11:17:23 -0800
On 12/1/03 8:50 PM, "Larry Gerndt" <email@hidden> wrote:
>
>> 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 this same behavior happen when you target other Carbon apps (like
Finder, iTunes, AppearanceSample, etc.)? Does this same behavior happen when
you target a Cocoa 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).
Are you sure this window UIElement is the one you think it is? Do the
AXSize, AXPosition, AXTitle and other attributes match your expectations?
Error -25202 suggests that you are getting some other window that really is
destroyed by the time you act on it. Are you running any apps which might be
displaying a transient overlay at the time you find the window UIElement?
_______________________________________________
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.