Re: Window title change notification in Apple Safari
Re: Window title change notification in Apple Safari
- Subject: Re: Window title change notification in Apple Safari
- From: email@hidden
- Date: Tue, 01 Mar 2011 18:31:09 +0100
Thank you for taking the time to answer my question, James.
It was really helpful.
Jake
On Feb 28, 2011, at 10:27 PM, James Dempsey wrote:
>
> On Feb 28, 2011, at 12:08 PM, email@hidden wrote:
>
>> Hello,
>>
>> I tried to implement the below-mentioned suggestion to get notified about tab switches in Safari. But adding the notification to observer doesn't return kAXErrorSuccess.
>> Unfortunately I'm not that familiar with accessibility to see my error. Could someone help me to get this right?
>>
>> AXUIElementRef app;
>> CFTypeRef window;
>> CFTypeRef tabs;
>>
>> // get safari app
>> app = AXUIElementCreateApplication(safari_pid);
>>
>> // get window
>> AXUIElementCopyAttributeValue(app, kAXFocusedWindowAttribute, &window);
>>
>> // get tabs
>> AXUIElementCopyAttributeValue(window, kAXTabGroupRole, &tabs);
>
> The window does not have a 'tab group role' attribute. You would ask for its kAXChildrenAttribute value and go through that array to find the element whose kAXRoleAttribute is kAXTabGroupRole
>
>>
>> // register for changes in tabs
>> AXObserverAddNotification(observer, tabs, kAXValueChangedNotification, self);
>
>
> There is more information in the reference docs at:
> http://developer.apple.com/library/mac/#documentation/Accessibility/Reference/AccessibilityLowlevel/AXUIElement_h/CompositePage.html
>
> Specifically to use an AXObserver you will need to
> 1. Create one and provide it a callback method (as defined in the header or in the docs above).
> 2. Create a runloop observer and add it to a running runloop. AXObserverGetRunLoopSource() documentation has a brief snippet that shows this.
> 3. Add notifications to the observer as needed.
>
> -James
>
>
>>
>> If there are other possibilities to receive notifications about tab changes (maybe Carbon events or s.th. like that) I'd be glad to hear about them, too.
>> best regards,
>> jake
>>
>>
>>
>>> When the selected tab of a tab group changes, AXValueChangedNotification is fired off for the AXTabGroup. Then you can examine the AXValue of this AXTabGroup and fetch the AXTitle of the AXRadioButton.
>>>
>>> Patti Hoa
>>>
>>> On Jun 17, 2010, at 8:38 AM, Peter wrote:
>>>
>>>>> Hi all,
>>>>>
>>>>> I am trying to keep track of window title changes in the user's launched applications. With exception of Apple Safari, everything seems to work fine. I got some useful help during the WWDC10.
>>>>>
>>>>> I noticed that Safari uses some AXTabGroup items and a change of the current tab doesn't seem to fire a title change notification.
>>>>>
>>>>> VoiceOver receives an event of a 'html content' change that would be useful for this case but I cannot find something related in the documentation.
>>>>>
>>>>> What solution exists to get a notification if the frontmost tab changed that also changed the window title?
>>>>>
>>>>> Thanks for any input,
>>>>> Peter
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Accessibility-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
> --------------------------------------------------
> James Dempsey
> AppKit Engineering
> Apple
> email@hidden
>
>
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden