#32001/7/13 9:39:21
基本的思路是这样的:当Mouse Down事件发生时,通过Tell告诉主窗口,让他来移动子窗口,使子窗口的不停地调整坐标,并与鼠标的移动对应。具体的代码如下:
tell the stage
set mPt to point(the mouseH,the mouseV)
set origRect to the rect of dWhichMIAW
repeat while the mouseDown
set newPt to point(the mouseH, the mouseV)
set deltaPt to newPt - mPt
set newRect to offset(origRect,getAt(deltaPt,1), ¬
getAt(deltaPt,2))
set the rect of dWhichMIAW to newRect
tell dWhichMIAW to updateStage
updateStage
end repeat
end tell
上面的代码可以直接用,不过要把dWhichMIAW换成你的窗口的名称。