$PBExportHeader$gf_dynamic_create_dwchild.srf $PBExportComments$动态创建下拉Datawindowchild global type gf_dynamic_create_dwchild from function_object end type forward prototypes global function integer gf_dynamic_create_dwchild (datawindow adw_dw, string as_colname, string as_sql) end prototypes global function integer gf_dynamic_create_dwchild (datawindow adw_dw, string as_colname, string as_sql);//===================gf_dynamic_create_dwchild ========== //gf_dynamic_create_dwchild(datawindow adw_dw, string as_colname, string as_sql) //datawindow adw_dw :datawindow //string as_colname :列名 //string as_sql :sql语法 //2009年4月1日 //============================== string ls_sql,ls_err datastore lds_tmp datawindowchild ldwc_child lds_tmp = create datastore if isnull(as_sql) or trim(as_sql) = '' then destroy lds_tmp return 0 end if if gf_check_colname(adw_dw,as_colname) = false then destroy lds_tmp return 0 end if ls_sql = sqlca.SyntaxFromSQL(as_sql,"style(type= grid)",ls_err) if len(ls_err) > 0 then destroy lds_tmp return -1 else lds_tmp.create(ls_sql,ls_err) if len(ls_err) > 0 then destroy lds_tmp return -1 else lds_tmp.settransobject(sqlca); lds_tmp.retrieve() end if end if string ls_coltype ls_coltype = adw_dw.describe(as_colname + ".coltype") if pos(lower(ls_coltype),'char') > 0 or pos(lower(ls_coltype),'text') > 0 then adw_dw.Modify(as_colname + ".DDDW.Name= d_dynamic_sql_str") else adw_dw.Modify(as_colname + ".DDDW.Name= d_dynamic_sql_dec") end if adw_dw.Modify(as_colname + ".DDDW.Lines= 15 ") adw_dw.Modify(as_colname + ".DDDW.PercentWidth=130") adw_dw.Modify(as_colname + ".DDDW.VScrollbar= Yes ") adw_dw.Modify(as_colname + ".DDDW.AllowEdit= Yes ") adw_dw.Modify(as_colname + ".DDDW.NilIsNull= Yes ") if adw_dw.getchild(as_colname,ldwc_child) = 1 then lds_tmp.rowscopy(1,lds_tmp.rowcount(),primary!,ldwc_child,1,primary!) else destroy lds_tmp return -1 end if destroy lds_tmp return 1 end function
来自:https://www.cnblogs.com/lenya/archive/2010/11/12/3706968.html