Window resizable - kAXGrowAreaAttribute always return NULL

人盡茶涼 提交于 2019-12-11 11:13:54

问题


In my app I want to check if windows from others apps are resizable.

I´m using the accessibility API to test if the window has the kAXGrowAreaAttribute attribute (if NULL is not resizable) as Peter Hosey answered in this question.

The problem is that the kAXGrowAreaAttribute returned value is always NULL it doesn´t matter if the window is resizable or not. Note: to retrieve the value I´m using the UIElementUtilities class from the Apple UIElementInspector example (I also have tried using AXUIElementCopyAttributeValue directly with the same result).

Any idea? I´m working in Lion, could be this the problem? Thanks in advance.

EDITED:

Playing around with the UIElementUtilities class methods I found a solution.

Just use the method

+ (BOOL)canSetAttribute:(NSString *)attributeName ofUIElement:(AXUIElementRef)element

with the kAXSizeAttribute and the focused window. It returns YES or NO depending if the window is sizable or not...


回答1:


It probably is because you're in Lion. The size box was killed off; resizable windows are resizable at every edge now.

And yes, testing whether the size can be changed is probably the right way. It seems to work for me in Snow Leopard.



来源:https://stackoverflow.com/questions/8293914/window-resizable-kaxgrowareaattribute-always-return-null

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!