如何获得和/或覆盖的Mac OSX窗口的最小尺寸 [英] How to get and/or overwrite the minimum size of windows in Mac OSX
问题描述
我要调整我的机器,我用的AppleScript完成的任何窗口,使用 GUI脚本。
该脚本看起来类似于以下内容:
I want to resize any window on my machine, which I accomplish with AppleScript, using GUI Scripting. The script looks similar to the following:
tell application "System Events"
set appProcess to the first process whose name is "Finder"
set appWindow to the front window of appProcess
set position of appWindow to {100, 100}
set size of appWindow to {10, 10}
end tell
我虽然宽度和高度设置为10px,查找程序将调整到至少344px宽,236px的高度。我与其他应用程序测试这和所有有最小宽度,该差异取决于应用。例如,TextMate的窗口的尺寸的至少213px * 129px
Even though I set the width and height to 10px, the Finder will resize to at least a width of 344px and a height of 236px. I tested this with other applications and all had a minimum width, which differed depending on the application. For example, TextMate windows have a size of at least 213px * 129px.
因为我有时需要到窗口大小调整为smalled宽度和高度,有没有办法来覆盖这个最小尺寸,即我的价值观是用来即使他们是太小?
Since I sometimes need to resize the windows to a smalled width and height, is there a way to override this minimum size, i.e. that my values are used even though they are "too small"?
如果不是,我需要知道的最小尺寸,让我知道,窗口将更大于预期。我将如何实现这一目标?
If not, I need to know the minimum size, so that I know that the window will be bigger than expected. How would I accomplish that?
具体问题如下:我正在写一个窗口平铺经理,所以我需要负责窗口的大小。最小尺寸创建一个到的问题:
The concrete problem is the following: I am writing a window tiling manager, therefore I need to be in charge of the size of the windows. The minimum size creates to problems:
- 我的瓷砖可能是某个应用程序的窗口太小,所以窗口可能在其他瓷砖重叠。
- 窗口可能比预期的更广泛/高,因此跨越我的屏幕的边界。 (例如,窗口靠近我的屏幕的右下角 - 我设置的宽度和高度,因此适合在角落里,但因为它有一个最小尺寸它不适合)
我感激的任何建议。 :)
I am thankful for any recommendations. :)
最良好的祝愿结果
弗洛里安
Best wishes
Florian
推荐答案
作为评论者指出:这是不可能的调整低于其发展(如在Interface Builder)中设置其最小尺寸的窗口。 然而,最小尺寸是有原因的:为prevent自动调整大小的问题,例如:按钮重叠或消失,由于太小视图大小。
As the commenters pointed out: It is not possible to resize a window below its minimum size which was set during development (e.g. in Interface Builder). However, minimum sizes are there for a reason: To prevent auto-resizing problems, e.g. buttons overlap or disappear due to a too small view size.
感谢Bavarious为答案。
Thanks to Bavarious for that answer.
PS:LRI补充说,它可能会绕过使用应用程序,例如在API最小尺寸使用Carbon API来调整iTunes或使用customly打造的AppleScript的API。感谢LRI!
PS: Lri added, that it may be possible to bypass minimum sizes using the API of an application, e.g. using the Carbon API to resize iTunes or using customly build AppleScript-APIs. Thanks Lri!
这篇关于如何获得和/或覆盖的Mac OSX窗口的最小尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!