窗口可调整大小 - kAXGrowAreaAttribute总是返回NULL [英] Window resizable - kAXGrowAreaAttribute always return NULL

查看:246
本文介绍了窗口可调整大小 - kAXGrowAreaAttribute总是返回NULL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我想检查来自其他应用程序的窗口是否可调整大小。

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

我使用辅助API测试窗口是否具有kAXGrowAreaAttribute属性如果NULL不可调整大小),因为Peter Hosey在此问题中回答。

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.

问题是,kAXGrowAreaAttribute返回的值总是NULL,如果窗口是可调整大小的,它不会有任何影响。注意:要使用Apple UIElementInspector 示例(我也试过直接使用AXUIElementCopyAttributeValue具有相同的结果)。

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.

已编辑:

使用UIElementUtilities类方法我找到了一个解决方案。

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

只需使用方法

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

与kAXSizeAttribute和焦点窗口。它返回YES或NO,取决于窗口是否大小...

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

推荐答案

这可能是因为你在狮子。大小盒被杀死了;

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.

这篇关于窗口可调整大小 - kAXGrowAreaAttribute总是返回NULL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆