$PBExportHeader$w_sysplan_dw_edit.srw forward global type w_sysplan_dw_edit from w_publ_base end type type cb_1 from uo_imflatbutton within w_sysplan_dw_edit end type type cb_2 from uo_imflatbutton within w_sysplan_dw_edit end type type cb_3 from uo_imflatbutton within w_sysplan_dw_edit end type type cb_5 from uo_imflatbutton within w_sysplan_dw_edit end type type dw_1 from u_dw_rbtnfilter within w_sysplan_dw_edit end type type r_bar from rectangle within w_sysplan_dw_edit end type type ln_bar from line within w_sysplan_dw_edit end type type ln_bar2 from line within w_sysplan_dw_edit end type end forward global type w_sysplan_dw_edit from w_publ_base integer width = 3611 integer height = 1580 string title = "布局设置" boolean minbox = false windowtype windowtype = response! long backcolor = 134217738 cb_1 cb_1 cb_2 cb_2 cb_3 cb_3 cb_5 cb_5 dw_1 dw_1 r_bar r_bar ln_bar ln_bar ln_bar2 ln_bar2 end type global w_sysplan_dw_edit w_sysplan_dw_edit type variables Long cur_type = -1 Long uc_column_int Long cur_nomodify[] Long cur_start = 0 String cur_win String dwoselect String cur_mod[] Long cur_resize = 0 Long cur_select = 0 Long ii_x_scroll,ii_y_scroll Long cur_x,cur_y String cur_chname[] long cur_mainid end variables forward prototypes public subroutine wf_open () public subroutine wf_aoto_taborder () public function integer wf_get_max (integer arg_type) public subroutine wf_show (integer arg_show[]) public subroutine wf_get_columnname (ref string arg_name[]) public function integer wf_get_max (integer arg_type, integer arg_long[]) end prototypes public subroutine wf_open (); long nColumnCount,nColumnIndex string des_1,des_2,des_3,szColumn,ls_pkcolname string ls_name nColumnCount = Integer( dw_1.Object.DataWindow.Column.Count) ls_name = dw_1.describe("DataWindow.Objects") string ls_a[] long i=0 do while pos(ls_name,'~t') > 1 i++ ls_a[i] = mid(ls_name,1,pos(ls_name,'~t') -1) ls_name = mid(ls_name,pos(ls_name,'~t') + 1,len(ls_name)) loop //i++ //ls_a[i] = ls_name // //FOR i= 1 to upperbound(ls_a) // des_1 = ls_a[i] // dw_1.modify(des_1+'.moveable = 1') // dw_1.modify(des_1+'.resizeable = 1') // dw_1.modify(des_1+'.border = 2') //// dw_1.modify(des_1+'.color = 255') //next end subroutine public subroutine wf_aoto_taborder ();//Long nColumnIndex,nColumnCount,lRow,ls_i,i = 1 //String des_1,des_2,szColumn,str //String Name[] //Long ll_x[],ll_y[],ll_width[],ll_height[] //Long ll_count // ////获取所有可以编辑的字段名称、横纵坐标 //nColumnCount = Integer( dw_1.Object.DataWindow.Column.Count) //FOR nColumnIndex = 1 TO nColumnCount // des_1 = dw_1.DESCRIBE( "#" + String(nColumnIndex) + ".Name") // des_2 = dw_1.DESCRIBE(des_1+ "_t.Text") // // szColumn = f_strip( des_2) // IF Long(dw_1.DESCRIBE(des_1+ ".Visible")) = 1 AND Long(dw_1.DESCRIBE(des_1+ ".x")) > 0 THEN // IF nColumnIndex <= uc_column_int THEN // Name[i] = des_1 // ll_x[i] = Long(dw_1.DESCRIBE(des_1+ ".x")) // ll_y[i] = Long(dw_1.DESCRIBE(des_1+ ".y")) // ll_width[i] = Long(dw_1.DESCRIBE(des_1+ ".width")) // ll_height[i] = Long(dw_1.DESCRIBE(des_1+ ".height")) // i++ // END IF // END IF //NEXT ////////---------------------------- // //ll_count = i - 1 // //Long Min,minnub //Long newx[],j = 1,ll_cnt,ll_t,midx[],k,ll_null[] //String newname[],ls_t,midname[] //String ls_null[] // //cnt: // ////找出纵坐标最小字段 //Min = ll_y[1] //minnub = 1 //FOR i = 2 TO ll_count // IF Min <= ll_y[i] THEN // // ELSE // Min = ll_y[i] // minnub = i // END IF //NEXT //////////////-------------------------- // ////找出与最少纵坐标字段同行的所有字段 //j = 1 //FOR i = 1 TO ll_count // IF ll_y[i] >= ll_y[minnub] AND ll_y[i] <= (ll_height[minnub] +ll_y[minnub]) THEN // midname[j] = Name[i] // midx[j] = ll_x[i] // j++ // END IF //NEXT //ll_cnt = j -1 ///////------------------------------- // ////将同行的字段进行排序(按横坐标大小) //FOR i = 1 TO ll_cnt - 1 // FOR j = i + 1 TO ll_cnt // IF midx[i] < midx[j] THEN // // ELSE // ll_t = midx[i] // midx[i] = midx[j] // midx[j] = ll_t // ls_t = midname[i] // midname[i] = midname[j] // midname[j] = ls_t // END IF // NEXT //NEXT //////////////---------------------------- // ////删除已经排序的字段 ////FOR i = 1 TO ll_count //// FOR j = 1 TO ll_cnt //// IF Name[i] = midname[j] THEN //// FOR k = i TO ll_count -1 //// Name[k] = Name[k+1] //// ll_x[k] = ll_x[k+1] //// ll_y[k] = ll_y[k+1] //// ll_width[k] = ll_width[k+1] //// ll_height[k] = ll_height[k+1] //// NEXT //// ll_count -- //// END IF //// NEXT ////NEXT // //FOR i = 1 TO ll_count // FOR j = 1 TO ll_cnt // IF Name[i] = midname[j] THEN // Name[i] = '' // k++ // END IF // NEXT //NEXT // //j = 0 //FOR i = ll_count TO 1 STEP -1 // IF Name[i] = '' THEN // FOR k = i TO ll_count -1 // Name[k] = Name[k+1] // ll_x[k] = ll_x[k+1] // ll_y[k] = ll_y[k+1] // ll_width[k] = ll_width[k+1] // ll_height[k] = ll_height[k+1] // NEXT // j++ // END IF //NEXT // //ll_count = ll_count - j // //////////---------------------------- // ////将排好序的一行字段,放入目的数组,清空临时数组 //Long ll_bnd //ll_bnd = UpperBound(newname) //FOR i = 1 TO ll_cnt // newname[ll_bnd + i] = midname[i] //NEXT // // //midname[] = ls_null[] //midx[] = ll_null[] //////////////----------------------------------- // //IF ll_count > 0 THEN // GOTO cnt //END IF // //Long aaa //String ls_taborder_auto = '' // //FOR i = 1 TO UpperBound(newname) // ls_taborder_auto = ls_taborder_auto + newname[i]+".Tabsequence="+String(i * 10)+'~t' //NEXT // // //String ls_data //ls_data = dw_1.DataObject ///////保存taporder //UPDATE sys_user_dwnSyntax // SET dwnSyntax_layout_column_taporder = :ls_taborder_auto // WHERE empid = :sys_empid // AND dwname = :ls_data; //IF sqlca.SQLCode = 0 THEN // IF sqlca.SQLNRows = 0 THEN // INSERT INTO sys_user_dwnSyntax // (empid, // dwname, // dwnSyntax_filter, // dwnSyntax_sort, // dwnSyntax_layout_column_visible, // dwnSyntax_layout_column_width, // dwnSyntax_layout_column_alignment, // dwnSyntax_layout_column_pos, // dwnSyntax_layout_column_edit, // dwnSyntax_layout_column_font, // dwnSyntax_layout_column_height, // dwnSyntax_layout_column_taporder) // Values(:publ_userid,:ls_data,'','','','','','','','','',:ls_taborder_auto); // END IF //END IF // //COMMIT; /////////////////////////// // ////messagebox('',ls_taborder_auto) // //dw_1.ins_mdfstr_column_taporder = ls_taborder_auto // //MessageBox('提示','OK') end subroutine public function integer wf_get_max (integer arg_type);//wf_get_max() long nColumnIndex,nColumnCount,lRow,ls_i,j=1 string des_1,des_2,szColumn,str long ll_x[100],ll_y[100],ll_width[100],ll_height[100] //获取所有可以编辑的字段名称、横纵坐标 string des_3,ls_pkcolname string ls_name nColumnCount = Integer( dw_1.Object.DataWindow.Column.Count) ls_name = dw_1.describe("DataWindow.Objects") string ls_a[] long i=0 do while pos(ls_name,'~t') > 1 i++ ls_a[i] = mid(ls_name,1,pos(ls_name,'~t') -1) ls_name = mid(ls_name,pos(ls_name,'~t') + 1,len(ls_name)) loop i++ ls_a[i] = ls_name FOR i= 1 to upperbound(ls_a) des_1 = ls_a[i] if long(dw_1.describe(des_1+'.visible')) = 1 then ll_x[j] = long(dw_1.describe(des_1+'.x')) ll_y[j] = long(dw_1.describe(des_1+'.y')) ll_width[j] = long(dw_1.describe(des_1+'.width')) ll_height[j] = long(dw_1.describe(des_1+'.height')) j++ end if next long ll_maxwid,ll_maxhig ll_maxwid = ll_x[1] + ll_width[1] for i = 2 to j -1 if ll_maxwid < ll_x[i] + ll_width[i] then ll_maxwid = ll_x[i] + ll_width[i] end if next ll_maxhig = ll_y[1] + ll_height[1] for i =2 to j -1 if ll_maxhig < ll_y[i] + ll_height[i] then ll_maxhig = ll_y[i] + ll_height[i] end if next if arg_type = 1 then return ll_maxwid + 50 elseif arg_type = 2 then return ll_maxhig + 50 end if end function public subroutine wf_show (integer arg_show[]);IF UpperBound(arg_show) <= 0 THEN RETURN Long i,ll_maxw,ll_maxh,ll_x,ll_y,ll_width,ll_height,ll_with_t,ll_x_t long j,ld_x,ld_y,ld_width,ld_height,ld_with_t,ld_x_t,k= 0 String arg_name[] FOR i = 1 TO UpperBound(arg_show) ll_maxh = wf_get_max(2) wf_get_columnname(arg_name) ll_x = Long(dw_1.DESCRIBE(arg_name[arg_show[i]]+'.x')) ll_x_t = Long(dw_1.DESCRIBE(arg_name[arg_show[i]]+'_t.x')) ll_y = Long(dw_1.DESCRIBE(arg_name[arg_show[i]]+'.y')) ll_width = Long(dw_1.DESCRIBE(arg_name[arg_show[i]]+'.width')) ll_with_t = Long(dw_1.DESCRIBE(arg_name[arg_show[i]]+'_t.width')) ll_height = Long(dw_1.DESCRIBE(arg_name[arg_show[i]]+'.height')) k= 0 for j = 1 TO UpperBound(arg_name) if arg_name[j] = arg_name[arg_show[i]] then continue ld_x = Long(dw_1.DESCRIBE(arg_name[j]+'.x')) ld_x_t = Long(dw_1.DESCRIBE(arg_name[j]+'_t.x')) ld_y = Long(dw_1.DESCRIBE(arg_name[j]+'.y')) ld_width = Long(dw_1.DESCRIBE(arg_name[j]+'.width')) ld_with_t = Long(dw_1.DESCRIBE(arg_name[j]+'_t.width')) ld_height = Long(dw_1.DESCRIBE(arg_name[j]+'.height')) if ld_y < ll_y and ld_y + ld_height > ll_y or ld_y > ll_y and ld_y < ll_y + ll_height then if ll_x_t > ld_x + ld_width or ld_x_t > ll_x + ll_width then goto ext end if else k++ end if next if k + 1 = UpperBound(arg_name) then goto ext IF ll_maxh - 35 + ll_height > dw_1.Height THEN IF ll_maxh - 35 + ll_height < THIS.Height - 300 THEN IF i > 1 THEN IF Long(dw_1.DESCRIBE(arg_name[arg_show[i - 1]]+'.x')) + Long(dw_1.DESCRIBE(arg_name[arg_show[i - 1]]+'.width')) & + 20 + Long(dw_1.DESCRIBE(arg_name[arg_show[i]]+'_t.width')) + Long(dw_1.DESCRIBE(arg_name[arg_show[i]]+'.width')) & <= dw_1.Width THEN dw_1.Modify(arg_name[arg_show[i]]+'.y ='+String(dw_1.DESCRIBE(arg_name[arg_show[i - 1]]+'.y'))) dw_1.Modify(arg_name[arg_show[i]]+'.x ='+String(Long(dw_1.DESCRIBE(arg_name[arg_show[i - 1]]+'.x')) + Long(dw_1.DESCRIBE(arg_name[arg_show[i - 1]]+'.width')) + 20 +ll_with_t)) dw_1.Modify(arg_name[arg_show[i]]+'_t.y ='+String(dw_1.DESCRIBE(arg_name[arg_show[i - 1]]+'.y'))) dw_1.Modify(arg_name[arg_show[i]]+'_t.x ='+String(Long(dw_1.DESCRIBE(arg_name[arg_show[i - 1]]+'.x')) + Long(dw_1.DESCRIBE(arg_name[arg_show[i - 1]]+'.width')) + 20)) ELSE dw_1.Modify(arg_name[arg_show[i]]+'.y ='+String(ll_maxh - 35)) dw_1.Modify(arg_name[arg_show[i]]+'.x ='+String(ll_with_t + 10)) dw_1.Modify(arg_name[arg_show[i]]+'_t.y ='+String(ll_maxh - 35)) dw_1.Modify(arg_name[arg_show[i]]+'_t.x ='+String(5)) dw_1.Height = ll_maxh - 15 + ll_height -200 END IF ELSE dw_1.Modify(arg_name[arg_show[i]]+'.y ='+String(ll_maxh - 35)) dw_1.Modify(arg_name[arg_show[i]]+'.x ='+String(ll_with_t + 10)) dw_1.Modify(arg_name[arg_show[i]]+'_t.y ='+String(ll_maxh - 35)) dw_1.Modify(arg_name[arg_show[i]]+'_t.x ='+String(5)) dw_1.Height = ll_maxh - 15 + ll_height -200 END IF END IF ELSE IF i > 1 THEN IF Long(dw_1.DESCRIBE(arg_name[arg_show[i - 1]]+'.x')) + Long(dw_1.DESCRIBE(arg_name[arg_show[i - 1]]+'.width')) & + 20 + Long(dw_1.DESCRIBE(arg_name[arg_show[i]]+'_t.width')) + Long(dw_1.DESCRIBE(arg_name[arg_show[i]]+'.width')) & <= dw_1.Width THEN dw_1.Modify(arg_name[arg_show[i]]+'.y ='+String(dw_1.DESCRIBE(arg_name[arg_show[i - 1]]+'.y'))) dw_1.Modify(arg_name[arg_show[i]]+'.x ='+String(Long(dw_1.DESCRIBE(arg_name[arg_show[i - 1]]+'.x')) + Long(dw_1.DESCRIBE(arg_name[arg_show[i - 1]]+'.width')) + 20 +ll_with_t)) dw_1.Modify(arg_name[arg_show[i]]+'_t.y ='+String(dw_1.DESCRIBE(arg_name[arg_show[i - 1]]+'.y'))) dw_1.Modify(arg_name[arg_show[i]]+'_t.x ='+String(Long(dw_1.DESCRIBE(arg_name[arg_show[i - 1]]+'.x')) + Long(dw_1.DESCRIBE(arg_name[arg_show[i - 1]]+'.width')) + 20)) ELSE dw_1.Modify(arg_name[arg_show[i]]+'.y ='+String(ll_maxh - 35)) dw_1.Modify(arg_name[arg_show[i]]+'.x ='+String(ll_with_t + 10)) dw_1.Modify(arg_name[arg_show[i]]+'_t.y ='+String(ll_maxh - 35)) dw_1.Modify(arg_name[arg_show[i]]+'_t.x ='+String(5)) END IF ELSE dw_1.Modify(arg_name[arg_show[i]]+'.y ='+String(ll_maxh - 35)) dw_1.Modify(arg_name[arg_show[i]]+'.x ='+String(ll_with_t + 10)) dw_1.Modify(arg_name[arg_show[i]]+'_t.y ='+String(ll_maxh - 35)) dw_1.Modify(arg_name[arg_show[i]]+'_t.x ='+String(5)) END IF END IF ext: NEXT end subroutine public subroutine wf_get_columnname (ref string arg_name[]);long nColumnIndex,nColumnCount,lRow,ls_i,i= 0 string ls_name[],des_1,des_2,szColumn s_dw_uc_rbtnfilter_setlayout_rt ls_s_rt nColumnCount = Integer( dw_1.Object.DataWindow.Column.Count) For nColumnIndex = 1 To nColumnCount des_1= dw_1.Describe( "#" + String(nColumnIndex) + ".Name") des_2= dw_1.describe(des_1+ "_t.Text") szColumn = f_strip( des_2) If szColumn <> "!" Then i++ ls_name[nColumnIndex] = des_1 end if next arg_name = ls_name //return ls_name end subroutine public function integer wf_get_max (integer arg_type, integer arg_long[]);//wf_get_max() long nColumnIndex,nColumnCount,lRow,ls_i,j=1 string des_1,des_2,szColumn,str long ll_x[100],ll_y[100],ll_width[100],ll_height[100] //获取所有可以编辑的字段名称、横纵坐标 string des_3,ls_pkcolname string ls_name nColumnCount = Integer( dw_1.Object.DataWindow.Column.Count) ls_name = dw_1.describe("DataWindow.Objects") string ls_a[] long i=0 //do while pos(ls_name,'~t') > 1 // i++ // ls_a[i] = mid(ls_name,1,pos(ls_name,'~t') -1) // ls_name = mid(ls_name,pos(ls_name,'~t') + 1,len(ls_name)) //loop // //i++ //ls_a[i] = ls_name wf_get_columnname(ls_a) FOR i= 1 to upperbound(ls_a) des_1 = ls_a[i] // if long(dw_1.describe(des_1+'.visible')) = 1 then ll_x[j] = long(dw_1.describe(des_1+'.x')) ll_y[j] = long(dw_1.describe(des_1+'.y')) ll_width[j] = long(dw_1.describe(des_1+'.width')) ll_height[j] = long(dw_1.describe(des_1+'.height')) j++ // end if next long ll_maxwid,ll_maxhig,k ll_maxwid = ll_x[1] + ll_width[1] for i = 2 to j -1 for k =1 to upperbound(arg_long) if i = arg_long[k] then goto ext1 end if next if ll_maxwid < ll_x[i] + ll_width[i] then ll_maxwid = ll_x[i] + ll_width[i] end if ext1: next ll_maxhig = ll_y[1] + ll_height[1] for i =2 to j -1 for k =1 to upperbound(arg_long) if i = arg_long[k] then goto ext2 end if next if ll_maxhig < ll_y[i] + ll_height[i] then ll_maxhig = ll_y[i] + ll_height[i] end if ext2: next if arg_type = 1 then return ll_maxwid + 50 elseif arg_type = 2 then return ll_maxhig + 50 end if end function on w_sysplan_dw_edit.create int iCurrent call super::create this.cb_1=create cb_1 this.cb_2=create cb_2 this.cb_3=create cb_3 this.cb_5=create cb_5 this.dw_1=create dw_1 this.r_bar=create r_bar this.ln_bar=create ln_bar this.ln_bar2=create ln_bar2 iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.cb_1 this.Control[iCurrent+2]=this.cb_2 this.Control[iCurrent+3]=this.cb_3 this.Control[iCurrent+4]=this.cb_5 this.Control[iCurrent+5]=this.dw_1 this.Control[iCurrent+6]=this.r_bar this.Control[iCurrent+7]=this.ln_bar this.Control[iCurrent+8]=this.ln_bar2 end on on w_sysplan_dw_edit.destroy call super::destroy destroy(this.cb_1) destroy(this.cb_2) destroy(this.cb_3) destroy(this.cb_5) destroy(this.dw_1) destroy(this.r_bar) destroy(this.ln_bar) destroy(this.ln_bar2) end on event open;call super::open;s_dw_uc_modify s_modify s_modify = Message.PowerObjectParm Long ll_billid,ll_scid dw_1.DataObject = s_modify.datawinname_uc uc_column_int = s_modify.uc_column_int cur_win = s_modify.win cur_mainid = s_modify.mainid //dw_1.Width = s_modify.uc_width //dw_1.Height = s_modify.uc_height cur_mod = s_modify.nomod cur_start = 1 //dw_1.Object.datawindow.detail.Height = 2000 //dw_1.Object.datawindow.detail.Height.AutoSize = TRUE dw_1.TriggerEvent(Constructor!) dw_1.SetTransObject(sqlca) cur_resize = 1 wf_open() end event event close;call super::close;s_resize s_size s_size.backtype = cur_type s_size.Width = dw_1.Width s_size.Height = dw_1.Height CloseWithReturn(THIS,s_size) end event event key;call super::key;//if key=Keyleftarrow! or key=Keyrightarrow! or key=Keyuparrow! or key=Keydownarrow! then // //end if end event event resize;call super::resize;ln_bar.EndX = THIS.Width ln_bar2.EndX = THIS.Width r_bar.Width = THIS.Width dw_1.width = this.width - dw_1.x - 40 dw_1.Height = this.Height - dw_1.y - 140 end event type cb_func from w_publ_base`cb_func within w_sysplan_dw_edit boolean visible = false string text = "工具" end type type cb_exit from w_publ_base`cb_exit within w_sysplan_dw_edit integer x = 805 integer width = 151 integer height = 164 integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event cb_exit::clicked;//不保存布局 cur_type = -1 close(parent) end event type cb_1 from uo_imflatbutton within w_sysplan_dw_edit integer x = 654 integer width = 151 integer height = 164 integer taborder = 30 boolean bringtotop = true string normalpicname = "ok.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;//保存修改好布局 cur_type = 1 dw_1.triggerevent(destructor!) ///////////////////// close(parent) end event type cb_2 from uo_imflatbutton within w_sysplan_dw_edit integer x = 503 integer width = 151 integer height = 164 integer taborder = 40 boolean bringtotop = true string text = "应用" string normalpicname = "update.BMP" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;//保存修改好布局 cur_type = 1 dw_1.TriggerEvent(Destructor!) ///////////////////// Long ll_width,ll_height f_reset_uc(cur_mainid,dw_1.Width,dw_1.Height) end event type cb_3 from uo_imflatbutton within w_sysplan_dw_edit integer width = 256 integer height = 164 integer taborder = 20 boolean bringtotop = true string text = "属性修改" string normalpicname = "setting.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;dw_1.triggerevent('ue_setlayout') end event type cb_5 from uo_imflatbutton within w_sysplan_dw_edit integer x = 256 integer width = 247 integer height = 164 integer taborder = 30 boolean bringtotop = true string text = "重置布局" string normalpicname = "p1.BMP" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;//dw_1.uf_reset_layout(uc_column_int) //dw_1.uf_save_profile_layout() dw_1.Triggerevent(Constructor!) end event type dw_1 from u_dw_rbtnfilter within w_sysplan_dw_edit integer y = 188 integer width = 3026 integer height = 704 integer taborder = 20 boolean bringtotop = true boolean hscrollbar = true boolean vscrollbar = true boolean resizable = true boolean hsplitscroll = true borderstyle borderstyle = StyleRaised! end type event constructor;call super::constructor;dw_1.InsertRow(0) end event type r_bar from rectangle within w_sysplan_dw_edit long linecolor = 16777215 long fillcolor = 1073741824 integer x = 2203 integer width = 91 integer height = 156 end type event constructor;this.fillcolor = 14215660 this.linecolor = 14215660 this.x = -1 this.y = -1 this.height = ln_bar.beginy - 5 end event type ln_bar from line within w_sysplan_dw_edit long linecolor = 268435456 integer linethickness = 4 integer beginy = 172 integer endx = 3200 integer endy = 172 end type type ln_bar2 from line within w_sysplan_dw_edit long linecolor = 16777215 integer linethickness = 4 integer beginx = 9 integer beginy = 176 integer endx = 3273 integer endy = 176 end type