$PBExportHeader$w_dw_rbtnfilter_setlayout.srw
forward
global type w_dw_rbtnfilter_setlayout from w_publ_base
end type
type dw_setlayout from datawindow within w_dw_rbtnfilter_setlayout
end type
type cb_ok from uo_imflatbutton within w_dw_rbtnfilter_setlayout
end type
type cb_reset from uo_imflatbutton within w_dw_rbtnfilter_setlayout
end type
type cbx_autosize from checkbox within w_dw_rbtnfilter_setlayout
end type
type em_height from editmask within w_dw_rbtnfilter_setlayout
end type
type st_1 from statictext within w_dw_rbtnfilter_setlayout
end type
type sle_win_name from singlelineedit within w_dw_rbtnfilter_setlayout
end type
end forward

global type w_dw_rbtnfilter_setlayout from w_publ_base
integer width = 2720
integer height = 1536
string title = "显示列选择"
boolean minbox = false
windowtype windowtype = response!
boolean center = true
dw_setlayout dw_setlayout
cb_ok cb_ok
cb_reset cb_reset
cbx_autosize cbx_autosize
em_height em_height
st_1 st_1
sle_win_name sle_win_name
end type
global w_dw_rbtnfilter_setlayout w_dw_rbtnfilter_setlayout

type variables
datastore ins_ds
s_dw_rbtnfilter_setlayout_rt ins_s_rt
s_dw_rbtn_tran s_rb_tran
end variables

on w_dw_rbtnfilter_setlayout.create
int iCurrent
call super::create
this.dw_setlayout=create dw_setlayout
this.cb_ok=create cb_ok
this.cb_reset=create cb_reset
this.cbx_autosize=create cbx_autosize
this.em_height=create em_height
this.st_1=create st_1
this.sle_win_name=create sle_win_name
iCurrent=UpperBound(this.Control)
this.Control[iCurrent+1]=this.dw_setlayout
this.Control[iCurrent+2]=this.cb_ok
this.Control[iCurrent+3]=this.cb_reset
this.Control[iCurrent+4]=this.cbx_autosize
this.Control[iCurrent+5]=this.em_height
this.Control[iCurrent+6]=this.st_1
this.Control[iCurrent+7]=this.sle_win_name
end on

on w_dw_rbtnfilter_setlayout.destroy
call super::destroy
destroy(this.dw_setlayout)
destroy(this.cb_ok)
destroy(this.cb_reset)
destroy(this.cbx_autosize)
destroy(this.em_height)
destroy(this.st_1)
destroy(this.sle_win_name)
end on

event open;call super::open;ins_s_rt.flag = 0 //默认返回——取消

datastore ls_ds
ls_ds  = Create datastore
ins_ds = Create datastore
ins_ds.DataObject = 'dw_rbtnfilter_setlayout'
Blob b_changes

s_rb_tran = Message.PowerObjectParm

ls_ds = s_rb_tran.dwr_ds

cbx_autosize.checked = s_rb_tran.dwr_autosize
em_height.text = string(s_rb_tran.dwr_height)

em_height.enabled = not cbx_autosize.checked

//ls_ds.rowscopy( 1, ls_ds.rowscount, /*dwbuffer f*/, /*datastore d*/, /*long i*/, /*dwbuffer t */)
ls_ds.GetFullState(b_changes)
ins_ds.SetFullState(b_changes)

//messagebox('',string(ins_ds.rowcount()))
ins_ds.ShareData( dw_setlayout)

end event

event close;call super::close;closewithreturn(this,ins_s_rt)
end event

type cb_func from w_publ_base`cb_func within w_dw_rbtnfilter_setlayout
boolean visible = false
end type

type cb_exit from w_publ_base`cb_exit within w_dw_rbtnfilter_setlayout
integer x = 2231
integer y = 120
integer width = 302
integer height = 100
string text = "取消"
end type

type dw_setlayout from datawindow within w_dw_rbtnfilter_setlayout
event dwnkey pbm_dwnkey
integer width = 2181
integer height = 1344
integer taborder = 30
boolean bringtotop = true
string title = "none"
string dataobject = "dw_rbtnfilter_setlayout"
boolean hscrollbar = true
boolean vscrollbar = true
boolean livescroll = true
borderstyle borderstyle = stylelowered!
end type

event dwnkey;IF  KeyDown(KeyControl!)  And KeyDown(KeyC!) THEN //涂选 ctrl + C 复制
	//	messagebox('','ssss')
	//sys_DataWindowselected = This.Object.DataWindow.Selected.Data
	::Clipboard(This.Object.DataWindow.Selected.Data)
END IF
end event

event clicked;if row>0  and dwo.name='ctitle' then
	this.object.cshow_flag[row]=1 - this.object.cshow_flag[row]
end if
end event

type cb_ok from uo_imflatbutton within w_dw_rbtnfilter_setlayout
integer x = 2231
integer y = 8
integer taborder = 20
boolean bringtotop = true
end type

event clicked;call super::clicked;dw_setlayout.AcceptText()
Int ls_i,ls_cnt = 0
FOR ls_i = 1 To dw_setlayout.RowCount()
	IF dw_setlayout.Object.cshow_flag[ls_i] = 1 THEN
		ls_cnt = 1
		EXIT
	END IF
NEXT
IF ls_cnt = 0 THEN
	MessageBox('错误','请至少选择显示一个列!')
	RETURN
END IF

Blob b_changes

ins_ds.GetFullState(b_changes)
ins_s_rt.b_changes = b_changes
ins_s_rt.flag = 1
ins_s_rt.b_autosize =  cbx_autosize.checked
ins_s_rt.l_height =  long(em_height.text)


Close(Parent)

end event

type cb_reset from uo_imflatbutton within w_dw_rbtnfilter_setlayout
integer x = 2231
integer y = 1228
integer taborder = 20
boolean bringtotop = true
string text = "重置布局"
end type

event clicked;call super::clicked;
ins_s_rt.flag=2

close(parent)
end event

type cbx_autosize from checkbox within w_dw_rbtnfilter_setlayout
integer x = 2222
integer y = 256
integer width = 416
integer height = 76
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 134217739
string text = "自动行高"
end type

event clicked;em_height.enabled = not this.checked
	
end event

type em_height from editmask within w_dw_rbtnfilter_setlayout
integer x = 2350
integer y = 348
integer width = 187
integer height = 84
integer taborder = 20
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
string text = "none"
borderstyle borderstyle = stylelowered!
string mask = "#####"
end type

type st_1 from statictext within w_dw_rbtnfilter_setlayout
integer x = 2208
integer y = 364
integer width = 123
integer height = 48
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 134217739
string text = "行高"
alignment alignment = right!
boolean focusrectangle = false
end type

type sle_win_name from singlelineedit within w_dw_rbtnfilter_setlayout
integer x = 14
integer y = 1356
integer width = 1275
integer height = 84
integer taborder = 30
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 134217739
boolean displayonly = true
borderstyle borderstyle = stylelowered!
end type

event constructor;this.Text = sys_dw_f2_win_name
end event

