动态改变DataWindow控件窗口中内容的几种实现方法

来源:互联网 发布:办公软件好学吗 编辑:程序博客网 时间:2024/05/22 04:57
动态改变DataWindow控件窗口中内容的几种实现方法(适合初学者)(网友 lingyun)


网友:lingyun Email: marine@yanan.xmu.edu.cn

在程序运行过程中,要动态的改变DataWindow控件窗口中内容的可用多种方法实现:
1.创建多个DataWindow对象,在程序运行时,通过一按钮控件的Click事件来改变DataWindow对象
if dw_control.dataobject=d_object1 then
dw_control.dataobject=d_object2
else
dw_control.dataobject=d_object1
end if
dw_control.settransobject(SQLCA)
dw_control.retrieve()
2.使用setsqlselect函数
dw_control.setsqlselect("select * from table1")
dw_control.retrieve()
3.使用modify函数
dw_control.modify("datawinodw.table.select='select * from table1'")
4.使用create(syntax{,errorbuffer})函数
syntax有三种方法实现:
调用libraryexport()
调用syntaxfromsql()
用户自定义
如:
string ls_select,ls_present
ls_select="select * from table1 where name like 'l%'"
ls_present="style(type=form)"
ls_syntax=SQLCA.syntaxfromsql(ls_select,ls_present)
dw_control.create(ls_syntax)
dw_control.settransobject(SQLCA)
dw_control.retrieve()
5.或者自己动态创建一个DataWindow控件
打开new user boject 对话框,创建一标准DataWindow类用户对象
根据需要对控件增加功能,并保存到用户库中
在程序中调用函数:openuserobject(userobjectvar{,x,y})
窗口关闭前清除对象:closeuserobject() 
原创粉丝点击