pfc_print


pfcmain.pbl   >   pfc_n_ds   >   pfc_print   

Full name pfc_n_ds.pfc_print
Access public
Extend of integer
Return value integer
Prototype event integer pfc_print()

Name Datatype
No Data

Name Datatype
lds_selection datastore
li_rc integer
ll_cnt long
ll_selected long[]
ll_selectedcount long
ll_selectedrow long
ls_val string
lstr_printdlg s_printdlgattrib

event pfc_print;//////////////////////////////////////////////////////////////////////////////
//
//	Event:  pfc_print
//
//	Arguments:  none
//
//	Returns:  integer
//	 1 = success
//	-1 = error
//
//	Description:
//	Opens the print dialog to allow user to change print settings,
//	and then prints the DataWindow.
//
//////////////////////////////////////////////////////////////////////////////
//	
//	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.
//
//////////////////////////////////////////////////////////////////////////////

integer	li_rc
long		ll_selectedcount
long		ll_selectedrow
long		ll_selected[]
long		ll_cnt
string		ls_val
datastore				lds_selection
s_printdlgattrib		lstr_printdlg

li_rc = this.event pfc_printdlg (lstr_printdlg)
if li_rc < 0 then
	return li_rc
end if

// Print selection
if this.object.datawindow.print.page.range = "selection" then
	// Get selected count
	do
		ll_selectedrow = this.GetSelectedRow (ll_selectedrow)
		if ll_selectedrow > 0 then
			ll_selectedcount++
			ll_selected[ll_selectedcount] = ll_selectedrow
		end if
	loop while ll_selectedrow > 0
	
	if ll_selectedcount > 0 then
		// Create a datastore to print selected rows
		lds_selection = create datastore
		lds_selection.dataobject = this.dataobject

		// First discard any data in the dataobject
		lds_selection.Reset()

		// Copy selected rows
		for ll_cnt = 1 to ll_selectedcount
			if this.RowsCopy (ll_selected[ll_cnt], ll_selected[ll_cnt], primary!, lds_selection, 2147483647, primary!) < 0 then
				return -1
			end if
		next

		// Capture print properties of original DW
		// (Note:  this syntax uses Describe/Modify PS functions to avoid 64K segment limit)
		ls_val = this.Describe ("datawindow.print.collate")
		lds_selection.Modify ("datawindow.print.collate = " + ls_val)

		ls_val = this.Describe ("datawindow.print.color")
		lds_selection.Modify ("datawindow.print.color = " + ls_val)

		ls_val = this.Describe ("datawindow.print.columns")
		lds_selection.Modify ("datawindow.print.columns = " + ls_val)

		ls_val = this.Describe ("datawindow.print.columns.width")
		lds_selection.Modify ("datawindow.print.columns.width = " + ls_val)

		ls_val = this.Describe ("datawindow.print.copies")
		lds_selection.Modify ("datawindow.print.copies = " + ls_val)

		ls_val = this.Describe ("datawindow.print.documentname")
		lds_selection.Modify ("datawindow.print.documentname = " + ls_val)

		ls_val = this.Describe ("datawindow.print.duplex")
		lds_selection.Modify ("datawindow.print.duplex = " + ls_val)

		ls_val = this.Describe ("datawindow.print.filename")
		lds_selection.Modify ("datawindow.print.filename = " + ls_val)

		ls_val = this.Describe ("datawindow.print.margin.bottom")
		lds_selection.Modify ("datawindow.print.margin.bottom = " + ls_val)

		ls_val = this.Describe ("datawindow.print.margin.left")
		lds_selection.Modify ("datawindow.print.margin.left = " + ls_val)

		ls_val = this.Describe ("datawindow.print.margin.right")
		lds_selection.Modify ("datawindow.print.margin.right = " + ls_val)

		ls_val = this.Describe ("datawindow.print.margin.top")
		lds_selection.Modify ("datawindow.print.margin.top = " + ls_val)

		ls_val = this.Describe ("datawindow.print.orientation")
		lds_selection.Modify ("datawindow.print.orientation = " + ls_val)

		ls_val = this.Describe ("datawindow.print.page.range")
		lds_selection.Modify ("datawindow.print.page.range = " + ls_val)

		ls_val = this.Describe ("datawindow.print.page.rangeinclude")
		lds_selection.Modify ("datawindow.print.page.rangeinclude = " + ls_val)

		ls_val = this.Describe ("datawindow.print.paper.size")
		lds_selection.Modify ("datawindow.print.paper.size = " + ls_val)

		ls_val = this.Describe ("datawindow.print.paper.source")
		lds_selection.Modify ("datawindow.print.paper.source = " + ls_val)

		ls_val = this.Describe ("datawindow.print.prompt")
		lds_selection.Modify ("datawindow.print.prompt = " + ls_val)

		ls_val = this.Describe ("datawindow.print.quality")
		lds_selection.Modify ("datawindow.print.quality = " + ls_val)

		ls_val = this.Describe ("datawindow.print.scale")
		lds_selection.Modify ("datawindow.print.scale = " + ls_val)
	end if
end if

// Print
if IsValid (lds_selection) then
	li_rc = lds_selection.Print (true)
	destroy lds_selection
else
	li_rc = this.Print (true)
end if

this.object.datawindow.print.filename = ""
this.object.datawindow.print.page.range = ""

return li_rc
end event

     
Name Owner
No Data

     
Name Owner
datastore.describe datastore
datastore.getselectedrow datastore
datastore.modify datastore
datastore.print datastore
datastore.reset datastore
datastore.rowscopy datastore
systemfunctions.isvalid systemfunctions
pfc_n_ds.pfc_printdlg pfc_n_ds

     
Full name
No Data

     
Name Scope
No Data