主题:  在创建不规则的窗口下 如何托动stage

maya2001

职务:普通成员
等级:1
金币:0.0
发贴:2
注册:2001/3/27 14:39:45
#12001/7/12 23:20:12
在创建不规则的窗口下 如何托动stage

我不想在create projector show title bar
而是子几画的 title 能不能作推动

thanks



漫天飞雪

职务:普通成员
等级:1
金币:0.0
发贴:14
注册:2001/3/6 17:10:37
#22001/7/12 23:32:19
是啊是啊,我也想问这个问题呢,高手给解答解答巴,thx:)



cizi3000

职务:普通成员
等级:1
金币:1.0
发贴:166
注册:2001/1/8 23:17:38
#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换成你的窗口的名称。



maya2001

职务:普通成员
等级:1
金币:0.0
发贴:2
注册:2001/3/27 14:39:45
#42001/7/13 10:01:42
thanks