Re: Testing whether a window 'really' has a title
Re: Testing whether a window 'really' has a title
- Subject: Re: Testing whether a window 'really' has a title
- From: John Louch <email@hidden>
- Date: Thu, 20 Feb 2003 07:12:28 -0800
>
My app wants to provide a menu similar to that in the dock, to allow the
>
user to bring specific windows to the front.
>
>
Obviously it should exclude any window which doesn't have a title.
>
>
You would think that the simple solution would be to get the
>
kAXTitleAttribute, see whether it exists and see if it has any length.
>
>
Unfortunately, some windows have a valid kAXTitleAttribute, but never show
>
such a thing on screen (and therefore as far as the user is concerned they
>
don't really have a title).
>
>
An example of such windows are those belonging to Stickies. All of its
>
windows have a kAXTitleAttribute of "Sticky", but is never displayed to the
>
user.
>
>
Trying to work around this problem, I then decided to check whether the
>
window also has a kAXTitleUIElementAttribute. It seems sensible that a
>
window without such an attribute wouldn't have a visible title.
>
>
This solved the Stickies case, but falls over with iTunes main window which
>
does have a kAXTitleAttribute, but no kAXTitleUIElementAttribute.
>
>
I then noticed that Stickies does actually have a
>
kAXTitleUIElementAttribute, but it has a null value, whereas iTunes just
>
doesn't have the attribute at all.
>
>
So my current thinking is that a window has a valid title if:
>
>
It has a non-empty kAXTitleAttribute
>
AND
>
(
>
It doesn't have a kAXTitleUIElementAttribute at all.
>
OR
>
It has a non-null kAXTitleUIElementAttribute
>
)
>
>
Without having to hard-code a bunch of special-case applications, does the
>
above seem a good workaround to the current situation?
This should definitely work. Basically what you have found is a discrepancy
between the Carbon and Cocoa implementations. You will find that if a
UIElement does not have an attribute most of the time in the Carbon
implementation the attribute will be removed from the list of attributes.
In Cocoa, the rule is a role/class always has a set of known attributes. If
they do no exist the will be either nil or kAXErrorNoValue.
>
>
Matt Gough
>
_______________________________________________
>
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.
---------------------------------------------
John Louch Internet #: email@hidden
(805) 546 0216
_______________________________________________
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.