$PBExportHeader$w_pz_ch_fx.srw
$PBExportComments$协同物料配置选择窗口(fx_color/fx_color_wood/fx_color_pcode/fx_pztype_mx/fx_mtrl_configure)
forward
global type w_pz_ch_fx from window
end type
type dw_1 from u_dw_rbtnfilter within w_pz_ch_fx
end type
end forward

global type w_pz_ch_fx from window
integer width = 1472
integer height = 1348
boolean titlebar = true
string title = "选择"
boolean controlmenu = true
windowtype windowtype = response!
long backcolor = 16777215
string icon = "graphics\chain_link_128px.ico"
dw_1 dw_1
end type
global w_pz_ch_fx w_pz_ch_fx

type variables
s_fx_pzwin_open ins_s

string ins_ret
end variables

on w_pz_ch_fx.create
this.dw_1=create dw_1
this.Control[]={this.dw_1}
end on

on w_pz_ch_fx.destroy
destroy(this.dw_1)
end on

event open;ins_s = Message.PowerObjectParm

if IsNull(ins_s) then
	MessageBox('提示', '打开方式有误(structure)')
	Close(this)
	return
end if

if IsNull(ins_s.arg_ds) then
	MessageBox('提示', '打开方式有误(datastore)')
	Close(this)
	return
end if

long typeid
if (Pos(ins_s.arg_colname, 'status') > 0) then
	this.Title = '配置选择'
	typeid = ins_s.arg_statustype
elseif (Pos(ins_s.arg_colname, 'woodcode') > 0) then
	this.Title = '配置1选择'
	typeid = ins_s.arg_woodcodetype
elseif (Pos(ins_s.arg_colname, 'pcode') > 0) then
	this.Title = '配置2选择'
	typeid = ins_s.arg_pcodetype
end if

environment exerun_env 
GetEnvironment(exerun_env)
this.X = ins_s.arg_x + 100
this.Y = ins_s.arg_y
if THIS.X + this.width > PixelsToUnits(exerun_env.screenwidth, XPixelsToUnits!) - 100 then 
	THIS.X = PixelsToUnits(exerun_env.screenwidth, XPixelsToUnits!) - this.width - 100
end if
if THIS.Y + this.height > PixelsToUnits(exerun_env.screenheight, XPixelsToUnits!) - 350 then 
	THIS.Y = PixelsToUnits(exerun_env.screenheight, XPixelsToUnits!) - this.height - 350
end if

dw_1.SetRedraw(false)
dw_1.DataObject = ins_s.arg_ds.DataObject
if ins_s.arg_ds.RowCount() > 0 then dw_1.Object.Data = ins_s.arg_ds.Object.Data

if (ins_s.arg_ds.DataObject = 'ds_fx_pztype_mx') then
	dw_1.SetFilter('typeid_erp = ' + string(typeid))
	dw_1.Filter()
elseif (ins_s.arg_ds.DataObject = 'ds_fx_mtrl_configure') then
	dw_1.SetFilter('Mtrlid_erp = ' + string(ins_s.arg_mtrlid_erp))
	dw_1.Filter()
elseif (ins_s.arg_ds.DataObject = 'ds_fx_configure_codemx') then
	
end if
dw_1.SetRedraw(true)

ins_ret = ''

end event

event resize;dw_1.Width = this.workspacewidth( )
dw_1.Height = this.workspaceheight( )
end event

event close;CloseWithReturn(this, ins_ret)
end event

event key;if keydown(KeyEscape!) then
	Close(this)
end if
end event

type dw_1 from u_dw_rbtnfilter within w_pz_ch_fx
event ue_mousemove pbm_dwnmousemove
integer width = 1298
integer height = 1268
string dataobject = "ds_fx_color"
boolean hscrollbar = true
boolean vscrollbar = true
boolean rbutton_setposition_use = true
boolean titleclick_sort_use = true
end type

event ue_mousemove;IF row > 0 THEN
	THIS.SelectRow(0, FALSE)
	THIS.SelectRow(row, TRUE)
END IF
end event

event clicked;call super::clicked;if (row <= 0) then return

if (dw_1.DataObject = 'ds_fx_color') then
	ins_ret = Trim(dw_1.Object.colorname[row])
elseif (dw_1.DataObject = 'ds_fx_color_wood') then
	ins_ret = Trim(dw_1.Object.woodcode[row])
elseif (dw_1.DataObject = 'ds_fx_color_pcode') then
	ins_ret = Trim(dw_1.Object.pcode[row])
elseif (dw_1.DataObject = 'ds_fx_pztype_mx') then
	ins_ret = Trim(dw_1.Object.dscrp[row])
elseif (dw_1.DataObject = 'ds_fx_mtrl_configure') then
	ins_ret = Trim(dw_1.Object.name[row])
elseif (dw_1.DataObject = 'ds_fx_configure_codemx') then
	ins_ret = Trim(dw_1.Object.namemx[row])
end if

Close(parent)
end event

event dwnkey;if keydown(KeyEscape!) then
	Close(parent)
end if
end event

