pfc_printdlg


pfcmain.pbl   >   pfc_n_ds   >   pfc_printdlg   

Full name pfc_n_ds.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 = success
//	-1 = error
//
//	Description:  
//	Opens the print dialog for this datastore, 
//	and sets the print values the user selected for the DW.
//
//////////////////////////////////////////////////////////////////////////////
//	
//	Revision History
//
//	Version
//	6.0   Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
//	Copyright © 1996-1997 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"
end if
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
end if

// 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_n_ds.pfc_print pfc_n_ds

     
Name Owner
datastore.describe datastore
datastore.getselectedrow datastore
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_n_ds.of_getparentwindow pfc_n_ds
pfc_n_ds.pfc_preprintdlg pfc_n_ds

     
Full name
s_printdlgattrib

     
Name Scope
No Data