$PBExportHeader$w_sys_printpagesetting.srw
forward
global type w_sys_printpagesetting from w_publ_base
end type
type cb_ok from uo_imflatbutton within w_sys_printpagesetting
end type
type st_1 from statictext within w_sys_printpagesetting
end type
type rb_1 from radiobutton within w_sys_printpagesetting
end type
type rb_2 from radiobutton within w_sys_printpagesetting
end type
type rb_3 from radiobutton within w_sys_printpagesetting
end type
type sle_1 from singlelineedit within w_sys_printpagesetting
end type
type gb_1 from groupbox within w_sys_printpagesetting
end type
type st_2 from statictext within w_sys_printpagesetting
end type
type st_curpage from statictext within w_sys_printpagesetting
end type
type st_pagecount from statictext within w_sys_printpagesetting
end type
type st_5 from statictext within w_sys_printpagesetting
end type
type em_copies from editmask within w_sys_printpagesetting
end type
type cb_3 from uo_imflatbutton within w_sys_printpagesetting
end type
end forward

global type w_sys_printpagesetting from w_publ_base
integer x = 553
integer y = 288
integer width = 2043
integer height = 744
string title = "打印页选择"
boolean minbox = false
windowtype windowtype = response!
cb_ok cb_ok
st_1 st_1
rb_1 rb_1
rb_2 rb_2
rb_3 rb_3
sle_1 sle_1
gb_1 gb_1
st_2 st_2
st_curpage st_curpage
st_pagecount st_pagecount
st_5 st_5
em_copies em_copies
cb_3 cb_3
end type
global w_sys_printpagesetting w_sys_printpagesetting

type variables
INT OBJ_PAGECOUNT
datawindow OBJ_DW 
end variables

forward prototypes
public function string wf_checkexpr (string obj_str)
end prototypes

public function string wf_checkexpr (string obj_str);//wf_checkexpr
long ls_flag,OBJ_COUNT,LS_SUBFLAG
INT CHOICE_FLAG
string LS_STR,STR_ARRAY[],MID_STR
LS_STR=TRIM(OBJ_STR)+','
ls_flag=pos(LS_STR,",")
DO WHILE ls_flag>0 and OBJ_COUNT<=1000
	MID_STR=TRIM(left(LS_STR,ls_flag - 1))
	CHOICE_FLAG=0
	LS_SUBFLAG=pos(MID_STR,"-")
	IF INTEGER(MID_STR)>0 AND INTEGER(MID_STR)<=obj_pagecount THEN
	CHOICE_FLAG=1
	ELSEIF LS_SUBFLAG>0 THEN
		IF INTEGER(LEFT(MID_STR,LS_SUBFLAG - 1))>0 AND INTEGER(LEFT(MID_STR,LS_SUBFLAG - 1))<=obj_pagecount &
			AND INTEGER(RIGHT(MID_STR,LEN(MID_STR) - LS_SUBFLAG))>0 AND INTEGER(RIGHT(MID_STR,LEN(MID_STR) - LS_SUBFLAG))<=obj_pagecount &
			AND INTEGER(LEFT(MID_STR,LS_SUBFLAG - 1))<INTEGER(RIGHT(MID_STR,LEN(MID_STR) - LS_SUBFLAG)) THEN
		CHOICE_FLAG=1
		END IF
	END IF
	IF CHOICE_FLAG=1 THEN
		OBJ_COUNT++
		STR_ARRAY[OBJ_COUNT]=MID_STR
	END IF
	LS_STR=mid(LS_STR,ls_flag+1)
	ls_flag=pos(LS_STR,",")
LOOP

LS_STR=''
int ls_xx
for ls_xx=1 to upperbound(STR_ARRAY)
	IF ls_xx=1 THEN 
		LS_STR=LS_STR+STR_ARRAY[ls_xx]
	ELSE
		LS_STR=LS_STR+','+STR_ARRAY[ls_xx]
	END IF
next

RETURN LS_STR
end function

on w_sys_printpagesetting.create
int iCurrent
call super::create
this.cb_ok=create cb_ok
this.st_1=create st_1
this.rb_1=create rb_1
this.rb_2=create rb_2
this.rb_3=create rb_3
this.sle_1=create sle_1
this.gb_1=create gb_1
this.st_2=create st_2
this.st_curpage=create st_curpage
this.st_pagecount=create st_pagecount
this.st_5=create st_5
this.em_copies=create em_copies
this.cb_3=create cb_3
iCurrent=UpperBound(this.Control)
this.Control[iCurrent+1]=this.cb_ok
this.Control[iCurrent+2]=this.st_1
this.Control[iCurrent+3]=this.rb_1
this.Control[iCurrent+4]=this.rb_2
this.Control[iCurrent+5]=this.rb_3
this.Control[iCurrent+6]=this.sle_1
this.Control[iCurrent+7]=this.gb_1
this.Control[iCurrent+8]=this.st_2
this.Control[iCurrent+9]=this.st_curpage
this.Control[iCurrent+10]=this.st_pagecount
this.Control[iCurrent+11]=this.st_5
this.Control[iCurrent+12]=this.em_copies
this.Control[iCurrent+13]=this.cb_3
end on

on w_sys_printpagesetting.destroy
call super::destroy
destroy(this.cb_ok)
destroy(this.st_1)
destroy(this.rb_1)
destroy(this.rb_2)
destroy(this.rb_3)
destroy(this.sle_1)
destroy(this.gb_1)
destroy(this.st_2)
destroy(this.st_curpage)
destroy(this.st_pagecount)
destroy(this.st_5)
destroy(this.em_copies)
destroy(this.cb_3)
end on

event open;call super::open;OBJ_DW=Message.PowerObjectParm	

IF OBJ_DW.DATAOBJECT='' THEN RETURN

st_curpage.text='[第 '+OBJ_DW.Describe("Evaluate('Page()',"+trim(string(OBJ_DW.getrow()))+")")+' 页]'
st_pagecount.text='[共 '+OBJ_DW.Describe("Evaluate('Pagecount()',0)")+' 页]'
st_1.text='共 '+trim(string(OBJ_DW.rowCOUNT()))+' 个记录'
obj_pagecount=INTEGER(OBJ_DW.Describe("Evaluate('Pagecount()',0)"))

//OBJ_DW.setfilter('')
//OBJ_DW.filter()
//if ddlb_1.TotalItems ( )>=1 then ddlb_1.SelectItem(1)
//w_sys_wait.HIDE()
////dw_1.SetRowFocusIndicator (Hand!)

end event

type cb_func from w_publ_base`cb_func within w_sys_printpagesetting
boolean visible = false
integer x = 1303
integer y = 36
boolean enabled = false
end type

type cb_exit from w_publ_base`cb_exit within w_sys_printpagesetting
integer x = 1664
integer y = 284
end type

type cb_ok from uo_imflatbutton within w_sys_printpagesetting
integer x = 1664
integer y = 36
integer width = 311
integer height = 96
integer taborder = 40
string text = "打印"
end type

event clicked;call super::clicked;IF rb_1.CHECKED THEN
	obj_dw.object.datawindow.print.page.range=''
ELSEIF rb_2.CHECKED THEN
	obj_dw.object.datawindow.print.page.range=OBJ_DW.Describe("Evaluate('Page()',"+trim(string(OBJ_DW.getrow()))+")")
ELSE
	obj_dw.object.datawindow.print.page.range=TRIM(sle_1.TEXT)
END IF
IF LONG(em_copies.TEXT)=1 THEN 
ELSE
	obj_dw.object.datawindow.print.copies=LONG(em_copies.TEXT)
END IF

obj_DW.PRINT()
obj_dw.object.datawindow.print.page.range=''
obj_dw.object.datawindow.print.copies=1
Close(PARENT)
end event

type st_1 from statictext within w_sys_printpagesetting
integer x = 73
integer y = 572
integer width = 887
integer height = 56
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 134217739
string text = "打印页选择"
boolean focusrectangle = false
end type

type rb_1 from radiobutton within w_sys_printpagesetting
integer x = 119
integer y = 200
integer width = 247
integer height = 76
integer taborder = 10
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 = "全部"
boolean checked = true
end type

event clicked;RB_3.POSTEVENT(CLICKED!)


end event

type rb_2 from radiobutton within w_sys_printpagesetting
integer x = 119
integer y = 288
integer width = 247
integer height = 76
integer taborder = 20
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;RB_3.POSTEVENT(CLICKED!)


end event

type rb_3 from radiobutton within w_sys_printpagesetting
integer x = 119
integer y = 372
integer width = 274
integer height = 76
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
string text = "目标页"
end type

event clicked;sle_1.enabled = this.checked 

IF THIS.checked AND TRIM(sle_1.TEXT)='' THEN
	cb_ok.ENABLED=FALSE
ELSE
	cb_ok.ENABLED=TRUE	
END IF


end event

type sle_1 from singlelineedit within w_sys_printpagesetting
event key pbm_keyup
integer x = 389
integer y = 368
integer width = 1166
integer height = 84
integer taborder = 40
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
boolean enabled = false
boolean autohscroll = false
borderstyle borderstyle = stylelowered!
end type

event key;RB_3.POSTEVENT(CLICKED!)

If  key = KeyEnter! Or Key = KeyDownArrow! Then //
keybd_event ( 9, 0, 0 , 0 ) // 按下tab 
keybd_event ( 9, 0, 2, 0 ) // 释放tab 
Return 1
End If 
end event

event modified;THIS.TEXT=wf_checkexpr(THIS.TEXT)
RB_3.POSTEVENT(CLICKED!)
end event

type gb_1 from groupbox within w_sys_printpagesetting
integer x = 50
integer y = 124
integer width = 1559
integer height = 412
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 134217739
string text = "打印页选择"
end type

type st_2 from statictext within w_sys_printpagesetting
integer x = 389
integer y = 464
integer width = 553
integer height = 60
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 134217739
boolean enabled = false
string text = "如:3,4,7-10"
boolean focusrectangle = false
end type

type st_curpage from statictext within w_sys_printpagesetting
integer x = 389
integer y = 300
integer width = 567
integer height = 60
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 134217739
boolean enabled = false
string text = "（第 1 页）"
boolean focusrectangle = false
end type

type st_pagecount from statictext within w_sys_printpagesetting
integer x = 389
integer y = 216
integer width = 562
integer height = 60
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 134217739
boolean enabled = false
string text = "（共 1 页）"
boolean focusrectangle = false
end type

type st_5 from statictext within w_sys_printpagesetting
integer x = 78
integer y = 32
integer width = 261
integer height = 64
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 134217739
boolean enabled = false
string text = "打印份数:"
alignment alignment = right!
boolean focusrectangle = false
end type

type em_copies from editmask within w_sys_printpagesetting
integer x = 366
integer y = 16
integer width = 215
integer height = 80
integer taborder = 40
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
string text = "1"
alignment alignment = right!
borderstyle borderstyle = stylelowered!
string mask = "###0"
end type

event modified;IF LONG(THIS.TEXT)<=0 THEN 
	CB_OK.ENABLED=FALSE
ELSE
	CB_OK.ENABLED=TRUE
END IF
end event

type cb_3 from uo_imflatbutton within w_sys_printpagesetting
integer x = 1664
integer y = 160
integer width = 311
integer height = 96
integer taborder = 40
string text = "打印设置"
end type

event clicked;call super::clicked;PRINTSETUP()
end event

