提问:设计/修改数据窗口时,我遇到一个问题??
tanye 2001-05-23 02:49:00 在获得数据窗口对象中实现动态创建一个对象(如:StaticText)时,
希望通过鼠标的拖动自动设计出对象的大小:
具体的脚本实现为:
//Instance Variable :
String p_objname
String is_newobjtype = "Text"
//Script: dw_dwedit.lbuttondown
p_x = this.pointerx();
p_y = this.pointery();
//创建一个缺省大小的StaticText
p_objname = of_create_object_new(is_newobjtype,p_x,p_y,10,10);
if not isnull(p_objname) then
ll_dwnew = 2;
//显示实时新建控件的高度和宽度,ID为'ZYX_mess'
of_create_object_new('message',p_x + 10,p_y + 10,260,100);
end if
//Script: dw_ewedit.mousemove
p_width = this.pointerx() - p_x;
p_height = this.pointery() - p_y;
if p_width < 0 then this.modify(p_objname + '.x=' + string(this.pointerx()))
if p_height < 0 then this.modify(p_objname + '.y=' + string(this.pointery()))
this.modify(p_objname + '.width=' + string(abs(p_width)))
this.modify(p_objname + '.height=' + string(abs(p_height)))
//更新提示信息:
this.modify('zyx_mess.x=' + string(this.pointerx() + 10))
this.modify('zyx_mess.y=' + string(this.pointery() - 100))
this.modify("zyx_mess.text='宽度:" + string(abs(p_width)) + "~r高度:" + string(abs(p_height)) + "'");
//Script: dw_edit.lbuttonup
this.modify('destroy zyx_mess');
setpointer(hourglass!)
of_get_objectlist(old_obj[])
//Script: dw_edit.rbuttonclick
this.modify('destroy '+ p_objname);
this.modify('destroy zyx_mess');
//在运行过程中如果拖动鼠标时,使Datawindow发生上下或左右滚动时,
计算出的p_width p_height 将发生错误,
请帮忙解决问题???