PB数据窗口自动换下一页

将以下内容保存为文件uo_datawindow_autoscroll.sru , 然后导入pbl中,再通过导入的uo_datawindow_autoscroll对象来创建dw(当前默认的时间为1秒,更改dw的“滚动时间间隔”属性可以设置滚动时间间隔)

 

$PBExportHeader$uo_datawindow_autoscroll.sru
forward
global type uo_datawindow_autoscroll from datawindow
end type
type timing_scroll from timing within uo_datawindow_autoscroll
end type
end forward

global type uo_datawindow_autoscroll from datawindow
integer width = 686
integer height = 400
string title = "none"
boolean livescroll = true
borderstyle borderstyle = stylelowered!
event ue_timer ( )
timing_scroll timing_scroll
end type
global uo_datawindow_autoscroll uo_datawindow_autoscroll

type variables
dec 滚动时间间隔 = 1
protected:
datawindow idw
end variables
event ue_timer();if Describe("evaluate('if(page() = pagecount(), 1, 0)'," + string(object.datawindow.lastrowonpage) + ")") = '1' then
    this.scrolltorow(1)
else
    this.scrollnextpage( )
end if
end event

on uo_datawindow_autoscroll.create
this.timing_scroll=create timing_scroll
end on

on uo_datawindow_autoscroll.destroy
destroy(this.timing_scroll)
end on

event constructor;idw = this
this.modify( 'create compute(band=foreground alignment="2" expression="page() + ~'/~' + pagecount()"border="0" color="255" x="199" y="8" height="64" width="326" format="[GENERAL]" html.valueishtml="0"  name=compute_page visible="1"  font.face="宋体" font.height="-9" font.weight="700"  font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )' )
timing_scroll.start(滚动时间间隔)
end event

type timing_scroll from timing within uo_datawindow_autoscroll descriptor "pb_nvo" = "true" 
end type

on timing_scroll.create
call super::create
TriggerEvent( this, "constructor" )
end on

on timing_scroll.destroy
TriggerEvent( this, "destructor" )
call super::destroy
end on

event timer;idw.triggerevent("ue_timer")
end event

 

posted @ 2013-12-30 16:46  春夏秋冬春  阅读(328)  评论(0编辑  收藏  举报