Testing whether a window 'really' has a title
Testing whether a window 'really' has a title
- Subject: Testing whether a window 'really' has a title
- From: Matt Gough <email@hidden>
- Date: Thu, 20 Feb 2003 10:55:58 +0000
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?
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.