File: w_print_options.srw
Size: 7879
Date: Tue, 22 Aug 2017 17:30:58 +0200
$PBExportHeader$w_print_options.srw
$PBExportComments$This window is for the print quality for the reports being printed.
forward
global type w_print_options from window
end type
type ddlb_quality from dropdownlistbox within w_print_options
end type
type st_3 from statictext within w_print_options
end type
type ddlb_papersource from dropdownlistbox within w_print_options
end type
type st_2 from statictext within w_print_options
end type
type ddlb_papersize from dropdownlistbox within w_print_options
end type
type st_1 from statictext within w_print_options
end type
type cb_ok from commandbutton within w_print_options
end type
type cb_cancel from commandbutton within w_print_options
end type
end forward

global type w_print_options from window
integer x = 174
integer y = 684
integer width = 1728
integer height = 496
boolean titlebar = true
string title = "Additional Print Options"
windowtype windowtype = response!
long backcolor = 79741120
ddlb_quality ddlb_quality
st_3 st_3
ddlb_papersource ddlb_papersource
st_2 st_2
ddlb_papersize ddlb_papersize
st_1 st_1
cb_ok cb_ok
cb_cancel cb_cancel
end type
global w_print_options w_print_options

type variables
s_print_options istr_opt
Environment ie_env
Datawindow idw_datawindow
end variables

forward prototypes
public subroutine wf_defaults ()
end prototypes

public subroutine wf_defaults ();istr_opt.i_papersize = 0
istr_opt.i_papersource = 0
istr_opt.i_quality = 0

ddlb_papersize.SelectItem(1)
ddlb_papersource.SelectItem(1)
ddlb_quality.SelectItem(1)

end subroutine

event open;Integer li_width, li_height

// get the passed datawindow so it can be modified
idw_datawindow = Message.PowerObjectParm

GetEnvironment(ie_env)

// calculate screen width/height in PBU's
li_width = PixelsToUnits(ie_env.ScreenWidth, XPixelsToUnits!)
li_height = PixelsToUnits(ie_env.ScreenHeight, YPixelsToUnits!)

// center the window 
This.x = (li_width / 2) - (This.width / 2)
This.y = (li_height / 2) - (This.height / 2)

// get datawindow defaults
wf_defaults()

end event

on w_print_options.create
this.ddlb_quality=create ddlb_quality
this.st_3=create st_3
this.ddlb_papersource=create ddlb_papersource
this.st_2=create st_2
this.ddlb_papersize=create ddlb_papersize
this.st_1=create st_1
this.cb_ok=create cb_ok
this.cb_cancel=create cb_cancel
this.Control[]={this.ddlb_quality,&
this.st_3,&
this.ddlb_papersource,&
this.st_2,&
this.ddlb_papersize,&
this.st_1,&
this.cb_ok,&
this.cb_cancel}
end on

on w_print_options.destroy
destroy(this.ddlb_quality)
destroy(this.st_3)
destroy(this.ddlb_papersource)
destroy(this.st_2)
destroy(this.ddlb_papersize)
destroy(this.st_1)
destroy(this.cb_ok)
destroy(this.cb_cancel)
end on

type ddlb_quality from dropdownlistbox within w_print_options
integer x = 805
integer y = 96
integer width = 389
integer height = 312
integer taborder = 20
integer textsize = -8
integer weight = 400
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
long textcolor = 33554432
boolean sorted = false
boolean vscrollbar = true
string item[] = {"Default","Letter","Draft"}
borderstyle borderstyle = stylelowered!
end type

type st_3 from statictext within w_print_options
integer x = 805
integer y = 32
integer width = 389
integer height = 64
integer textsize = -8
integer weight = 700
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
long textcolor = 33554432
long backcolor = 67108864
boolean enabled = false
string text = "Print Quality:"
boolean focusrectangle = false
end type

type ddlb_papersource from dropdownlistbox within w_print_options
integer x = 1280
integer y = 96
integer width = 389
integer height = 312
integer taborder = 30
integer textsize = -8
integer weight = 400
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
long textcolor = 33554432
boolean sorted = false
boolean vscrollbar = true
string item[] = {"Default","Upper","Lower","Middle","Manual","Auto"}
borderstyle borderstyle = stylelowered!
end type

type st_2 from statictext within w_print_options
integer x = 1280
integer y = 32
integer width = 389
integer height = 64
integer textsize = -8
integer weight = 700
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
long textcolor = 33554432
long backcolor = 67108864
boolean enabled = false
string text = "Paper Source:"
boolean focusrectangle = false
end type

type ddlb_papersize from dropdownlistbox within w_print_options
integer x = 37
integer y = 96
integer width = 677
integer height = 312
integer taborder = 10
integer textsize = -8
integer weight = 400
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
long textcolor = 33554432
boolean sorted = false
boolean vscrollbar = true
string item[] = {"Default","Letter 8 1/2 x 11","LetterSmall 8 1/2 x 11","Tabloid 17 x 11","Ledger 17 x 11","Legal 8 1/2 x 14","Statement 5 1/2 x 8 1/2","Executive 7 1/4 x 10 1/2"}
borderstyle borderstyle = stylelowered!
end type

type st_1 from statictext within w_print_options
integer x = 37
integer y = 32
integer width = 320
integer height = 64
integer textsize = -8
integer weight = 700
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
long textcolor = 33554432
long backcolor = 67108864
boolean enabled = false
string text = "Paper Size:"
boolean focusrectangle = false
end type

type cb_ok from commandbutton within w_print_options
integer x = 768
integer y = 256
integer width = 407
integer height = 100
integer taborder = 40
integer textsize = -8
integer weight = 700
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
string text = "OK"
boolean default = true
end type

event clicked;String ls_property

// set papersize
ls_property = ddlb_papersize.text
ls_property = Lower(Trim(Left(ls_property, Pos(ls_property, " "))))
CHOOSE CASE ls_property
   CASE "letter"
      istr_opt.i_papersize = 1
   CASE "lettersmall"
      istr_opt.i_papersize = 2
   CASE "tabloid"
      istr_opt.i_papersize = 3
   CASE "ledger"
      istr_opt.i_papersize = 4
   CASE "legal"
      istr_opt.i_papersize = 5
   CASE "statement"
      istr_opt.i_papersize = 6
   CASE "executive"
      istr_opt.i_papersize = 7
   CASE ELSE
      istr_opt.i_papersize = 0
END CHOOSE

// set papersource
ls_property = ddlb_papersource.text
ls_property = Lower(Trim(Left(ls_property, Pos(ls_property, " "))))
CHOOSE CASE ls_property
   CASE "upper"
      istr_opt.i_papersource = 1
   CASE "lower"
      istr_opt.i_papersource = 2
   CASE "middle"
      istr_opt.i_papersource = 3
   CASE "manual"
      istr_opt.i_papersource = 4
   CASE "auto"
      istr_opt.i_papersource = 7
   CASE ELSE
      istr_opt.i_papersource = 0
END CHOOSE

// set quality
ls_property = ddlb_quality.text
ls_property = Lower(Trim(Left(ls_property, Pos(ls_property, " "))))
CHOOSE CASE ls_property
   CASE "letter"
      istr_opt.i_quality = 1
   CASE "draft"
      istr_opt.i_quality = 4
   CASE ELSE
      istr_opt.i_quality = 0
END CHOOSE

// close window
istr_opt.b_ok = True

// cancel window
CloseWithReturn(Parent, istr_opt)

end event

type cb_cancel from commandbutton within w_print_options
integer x = 1243
integer y = 256
integer width = 407
integer height = 100
integer taborder = 50
integer textsize = -8
integer weight = 700
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
string text = "Cancel"
boolean cancel = true
end type

event clicked;istr_opt.b_ok = False

// cancel window
CloseWithReturn(Parent, istr_opt)

end event