我封装的窗体为啥没响应? 请高手赐教!!!

zhf_1021 2006-12-23 03:05:14
在数据窗口从数据库中检索数据时,当数据量少时不会感觉到延迟,但当数据量几十万以上是就会明显地感到延迟,为不让用户感到系统好像是无响应,在检索数据之前将示忙器弹出,以示系统忙,正在运行中。但示忙器总是无法正常工作。
下面我大概说一下示忙器的工作原理。
该示忙器由12个图片不停的相互切换让用户感到好像画面是在动的,从而认为系统仍在工作中。
问题如下:每次检索开始打开示忙器和关闭示忙器的图片竟然是一样的,也就是说没有切换图片。单独测试时没问题,但放在数据窗口检索开始时就会出问题。
请教大家该如何解决。代码如下:
forward
global type w_busindicator from window
end type
type p_disc from picture within w_busindicator
end type
end forward

global type w_busindicator from window
integer width = 352
integer height = 312
boolean border = false
windowtype windowtype = child!
long backcolor = 67108864
string icon = "AppIcon!"
boolean center = true
p_disc p_disc
end type
global w_busindicator w_busindicator

type variables
private:
int mPosition = 1

constant string Folder = "image"
end variables

event timer;mPosition ++
if mPosition > 12 then mPosition = 1
p_disc.picturename = Folder + "\" + string(mPosition) + ".bmp"//图片的名称为:1.bmp, 2.bmp, 3.bmp, .....

end event

on w_busindicator.create
this.p_disc=create p_disc
this.Control[]={this.p_disc}
end on

on w_busindicator.destroy
destroy(this.p_disc)
end on

event open;P_disc.x = 0
P_disc.y = 0
this.width = p_disc.width
this.height = p_disc.height
Timer(0.05, this)

end event

type p_disc from picture within w_busindicator
integer width = 338
integer height = 296
boolean originalsize = true
string picturename = "image\1.bmp"
boolean focusrectangle = false
end type

...全文
184 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
霖湘凝 2006-12-27
  • 打赏
  • 举报
回复
晕,pb不能支持多线程,
当你打开“示忙器”后资源被其后的查询占据,
timer当然就没有起到作用了。
rightyeah 2006-12-27
  • 打赏
  • 举报
回复
代码我没有看
向lz说的情况,一般都是需要在代码里面加yield(),让系统有机会处理一些别的事件,如果整个代码都是连续的(没有加yield),系统就会等整个代码都执行完了,才改变显示的内容
lovelihp 2006-12-23
  • 打赏
  • 举报
回复
顶完收工

740

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 脚本语言
社区管理员
  • 脚本语言社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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