pfc_printdlg


pfcmain.pbl   >   pfc_u_dw   >   pfc_printdlg   

Full name pfc_u_dw.pfc_printdlg
Access public
Extend of integer
Return value integer
Prototype event integer pfc_printdlg(ref s_printdlgattrib)

Name Datatype
No Data

Name Datatype
lb_collate boolean
li_copies integer
ll_pagecount long
ll_rc long
lnv_conversion n_cst_conversion
lnv_platform n_cst_platform
ls_collate string
ls_copies string
ls_filename string
ls_pagecount string
ls_pathname string
lw_parent window

event pfc_printdlg;//////////////////////////////////////////////////////////////////////////////
//	Event:  			pfc_printdlg
//	Arguments:		astr_printdlg:  print dialog structure by ref
//	Returns:			Integer - 1 if it succeeds and -1 if an error occurs
//	Description:	Opens the print dialog for this DataWindow, 
//						and sets the print values the user selected for the DW.
//////////////////////////////////////////////////////////////////////////////
//	Rev. History	Version
//						5.0   Initial version
//////////////////////////////////////////////////////////////////////////////
//	Copyright © 1996-1999 Sybase, Inc. and its subsidiaries.  All rights reserved.  Any distribution of the 
// PowerBuilder Foundation Classes (PFC) source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//////////////////////////////////////////////////////////////////////////////
boolean			lb_collate
integer			li_copies
long				ll_rc
long				ll_pagecount
string				ls_pagecount
string				ls_pathname = "Output"
string				ls_filename
string				ls_copies
string				ls_collate
n_cst_platform		lnv_platform
n_cst_conversion	lnv_conversion
window				lw_parent

// Initialize printdlg structure with current print values of DW
astr_printdlg.b_allpages = true

ls_copies = this.Object.DataWindow.Print.Copies
if not IsNumber (ls_copies) then	ls_copies = "1"

li_copies = Integer (ls_copies)
astr_printdlg.l_copies = li_copies

ls_collate = this.Object.DataWindow.Print.Collate
lb_collate = lnv_conversion.of_Boolean (ls_collate)
astr_printdlg.b_collate = lb_collate

astr_printdlg.l_frompage = 1
astr_printdlg.l_minpage = 1

ls_pagecount = this.Describe ("Evaluate ('PageCount()', 1)")
if IsNumber (ls_pagecount) then
	ll_pagecount = Long (ls_pagecount)
	astr_printdlg.l_maxpage = ll_pagecount
	astr_printdlg.l_topage = ll_pagecount
end if

if this.GetSelectedRow (0) = 0 then	astr_printdlg.b_disableselection = true

// Allow printdlg structure to have additional values
// set before opening print dialog
this.event pfc_preprintdlg (astr_printdlg)

// Open print dialog
f_setplatform (lnv_platform, true)
this.of_GetParentWindow (lw_parent)
ll_rc = lnv_platform.of_PrintDlg (astr_printdlg, lw_parent)
f_setplatform (lnv_platform, false)

// Set print values of DW based on users selection
if ll_rc > 0 then
	// Page Range
	if astr_printdlg.b_allpages then
		this.Object.DataWindow.Print.Page.Range = ""
	elseif astr_printdlg.b_pagenums then
		this.Object.DataWindow.Print.Page.Range = &
			String (astr_printdlg.l_frompage) + "-" + String (astr_printdlg.l_topage)
	elseif astr_printdlg.b_selection then
		this.Object.DataWindow.Print.Page.Range = "selection"
	end if

	// Collate copies
	this.Object.DataWindow.Print.Collate = astr_printdlg.b_collate

	// Number of copies
	this.Object.DataWindow.Print.Copies = astr_printdlg.l_copies

	// Print to file (must prompt user for filename first)
	if astr_printdlg.b_printtofile then
		if GetFileSaveName ("Print to File", ls_pathname, ls_filename, "prn", &
			"Printer Files,*.prn,All Files,*.*") <= 0 then
			return -1
		else
			this.Object.DataWindow.Print.Filename = ls_pathname
		end if
	end if
end if

return ll_rc
end event

     
Name Owner
pfc_u_dw.pfc_print pfc_u_dw

     
Name Owner
datawindow.describe datawindow
datawindow.getselectedrow datawindow
systemfunctions.getfilesavename systemfunctions
systemfunctions.integer systemfunctions
systemfunctions.isnumber systemfunctions
systemfunctions.long systemfunctions
systemfunctions.string systemfunctions
pfc_n_cst_platform.of_printdlg pfc_n_cst_platform
pfc_n_cst_conversion.of_boolean pfc_n_cst_conversion
f_setplatform.f_setplatform f_setplatform
pfc_u_dw.of_GetParentWindow pfc_u_dw
pfc_u_dw.pfc_preprintdlg pfc_u_dw

     
Full name
s_printdlgattrib

     
Name Scope
No Data