提问:设计/修改数据窗口时,我遇到一个问题??

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 将发生错误,
请帮忙解决问题???
...全文
84 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
tanye 2001-05-23
  • 打赏
  • 举报
回复
帮人帮到底,我会把全部分都给你噢
freshman113 2001-05-23
  • 打赏
  • 举报
回复
还有,当比例不是100%时,还要进行处理!
。。。。。
看了上面的,应该有所提示,自己完成吧。:)
freshman113 2001-05-23
  • 打赏
  • 举报
回复
肯定出错了!
因为,你使用的是pointerx(),pointery()这两个函数取得的是屏幕光标的位置。
因此,要加上滚动条位置,如下:

p_x = p_x + Integer( This.Describe("DataWindow.HorizontalScrollPosition") )
p_y = p_y + integer( This.Describe("DataWindow.VerticalScrollPosition") )

记得给分!!
tanye 2001-05-23
  • 打赏
  • 举报
回复
在Lbuttondown
mousemove
Lbuttonup
Rbuttonclick
中都有一个标志ib_newobj 来判断是否为新增对象状态
if ib_newobj then
<Script>
else
<Other script>
end if
Methodor 2001-05-23
  • 打赏
  • 举报
回复
dw_ewedit.mousemove??(p_width p_height 肯定出错!)

换个地方~~

1,077

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧