2

在 MAC OS 上开发时,除了窗口顶部的栏之外,有没有办法拖动堆栈窗口?如果我看不到顶部栏并尝试拖动堆栈窗口中间的某个位置,它会激活该组、对象等。我唯一的成功是使用堆栈属性窗口上的“大小和位置”。提前致谢...

4

1 回答 1

0

如果您在 IDE 中工作,可以键入 command-M 以显示消息框,并在消息框中键入以下代码:

set the loc of this stack to the screenLoc

这通常会将窗口顶部移动到屏幕的可见部分。你也可以使用

set the top of this stack to 100

这会将标题栏向下移动到屏幕顶部下方 100 像素处。

如果你想移动一个没有标题栏的堆栈窗口,你可以使用这个脚本:

on grabWindow
  if the platform is "MacOS" and (the decorations of the defaultStack contains "title" or the decorations of the defaultStack is "default") then
    put 22 into myMenuCorrection
  else
    put 0 into myMenuCorrection
  end if
  put "10,10,310,310" into myRect
  add myMenuCorrection to item 2 of myRect
  lock messages
  put (trunc(the width of this window/2) - the mouseH) into difH
  put (trunc(the height of this window/2) - the mouseV) into difV
  repeat until the mouse is up
    put the loc of this window into loc1
    put the screenMouseLoc into loc2
    add difH to item 1 of loc2
     add (difV + myMenuCorrection) to item 2 of loc2
    if loc1 is not loc2 then set the loc of this window to loc2
  end repeat
  unlock messages
end grabWindow

on mouseDown
  grabWindow
end mouseDown

我从我的一个项目中复制了这个脚本。实际上,您可能不需要整个脚本并且您可能认为它有点冗长,但有时对菜单栏进行更正可能很有用。

于 2014-09-20T20:49:21.963 回答