$PBExportHeader$uo_ljnc_listbox.sru forward global type uo_ljnc_listbox from listbox end type type datastore_1 from datastore within uo_ljnc_listbox end type type ljnc_lisbox_update_timer from timing within uo_ljnc_listbox end type type ljnc_lisbox_display_timer from timing within uo_ljnc_listbox end type end forward global type uo_ljnc_listbox from listbox integer width = 549 integer height = 476 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 borderstyle borderstyle = stylelowered! event ue_lbuttondblclk pbm_lbuttondblclk datastore_1 datastore_1 ljnc_lisbox_update_timer ljnc_lisbox_update_timer ljnc_lisbox_display_timer ljnc_lisbox_display_timer end type global uo_ljnc_listbox uo_ljnc_listbox type variables int display_count = 2 //默认2条 int display_time = 5 //listbox刷新周期 int update_time = 30//数据库请求更新周期 private int update_seconds = 0; private int display_seconds =0 ; private int c_display_row=0 //记录滚动到哪一条 private OLEObject o_ljnc_program end variables forward prototypes public subroutine getdata () public subroutine showdata () public subroutine sync_db (string arg_version) end prototypes event ue_lbuttondblclk;string ls_selecttext ls_selecttext = selecteditem() s_edit_index_tran ss_edit_index_tran ss_edit_index_tran.arg_string_code = ls_selecttext ss_edit_index_tran.ds_share=datastore_1 openwithparm(w_ljnc_preview,ss_edit_index_tran) if ls_selecttext = '' then return String lnc_title long ll_row,ll_rowcount lnc_title = left(ss_edit_index_tran.arg_string_code,pos(ss_edit_index_tran.arg_string_code,'[') -1) ll_rowcount= datastore_1.rowcount( ) FOR ll_row=1 TO ll_rowcount IF datastore_1.getitemstring( ll_row,1) =lnc_title THEN datastore_1.deleterow(ll_row) END IF NEXT end event public subroutine getdata ();datastore_1.retrieve(publ_userid) end subroutine public subroutine showdata ();long ll_row,ll_row_count,i reset( ) ll_row=c_display_row + 1 ll_row_count=c_display_row + display_count IF ll_row_count>=datastore_1.rowcount() THEN ll_row_count =datastore_1.rowcount() c_display_row=0 ELSE c_display_row=ll_row_count END IF FOR i=ll_row to ll_row_count additem(datastore_1.getitemstring( i , 1)+ '['+ String(datastore_1.getitemdatetime( i, 2),'yyyy-mm-dd')+ ']') NEXT end subroutine public subroutine sync_db (string arg_version);// 同步数据到本地 String lnc_type DateTime lastmodifydt IF Not IsNull(o_ljnc_program) THEN lnc_type = arg_version SELECT Max(dbo.lnc_notice.modifydt) Into :lastmodifydt From dbo.lnc_notice; IF IsNull(lastmodifydt) THEN lastmodifydt = DateTime(Date('1900-01-01'),Time('00:00:00')) o_ljnc_program.GetNoticeList(lnc_type,lastmodifydt) //调用LJNCProxy类方法GetNoticeList获取数据 END IF end subroutine on uo_ljnc_listbox.create this.datastore_1=create datastore_1 this.ljnc_lisbox_update_timer=create ljnc_lisbox_update_timer this.ljnc_lisbox_display_timer=create ljnc_lisbox_display_timer end on on uo_ljnc_listbox.destroy destroy(this.datastore_1) destroy(this.ljnc_lisbox_update_timer) destroy(this.ljnc_lisbox_display_timer) end on event constructor; //注册LJNC.DLL o_ljnc_program = Create oleobject uo_reghelper uo_reg uo_reg = Create uo_reghelper String arg_msg = '' IF FileExists('LJNC.dll') THEN IF uo_reg.ConnectToNewObject("LJNC.LJNCProxy", "LJNC.dll", Ref o_ljnc_program, Ref arg_msg) <> 1 THEN Destroy o_ljnc_program SetNull(o_ljnc_program) else o_ljnc_program.init(sqlca.ServerName, sqlca.Database, sqlca.LogID, sqlca.LogPass) END IF else Destroy o_ljnc_program SetNull(o_ljnc_program) END IF Destroy uo_reg datastore_1.settransobject(sqlca) GetData( ) //装入数据库记录 showdata() //显示记录 end event event destructor;f_del_file(f_ljnc_get_path()+'fjtemp\',this) //删除临时目录下的所有临时文件 end event type datastore_1 from datastore within uo_ljnc_listbox descriptor "pb_nvo" = "true" string dataobject = "dw_ljnc_unread_list" end type on datastore_1.create call super::create TriggerEvent( this, "constructor" ) end on on datastore_1.destroy TriggerEvent( this, "destructor" ) call super::destroy end on type ljnc_lisbox_update_timer from timing within uo_ljnc_listbox descriptor "pb_nvo" = "true" end type on ljnc_lisbox_update_timer.create call super::create TriggerEvent( this, "constructor" ) end on on ljnc_lisbox_update_timer.destroy TriggerEvent( this, "destructor" ) call super::destroy end on event timer;update_seconds = update_seconds +update_time IF update_seconds = update_time * 60 THEN sync_db(sys_cur_production_code) getdata() update_seconds=0 END IF end event event constructor;this.start(update_time) end event type ljnc_lisbox_display_timer from timing within uo_ljnc_listbox descriptor "pb_nvo" = "true" end type on ljnc_lisbox_display_timer.create call super::create TriggerEvent( this, "constructor" ) end on on ljnc_lisbox_display_timer.destroy TriggerEvent( this, "destructor" ) call super::destroy end on event timer;showdata( ) end event event constructor;this.start( display_time) end event