pfc_print


pfcmain.pbl   >   pfc_u_dw   >   pfc_print   

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

Name Datatype
No Data

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

event pfc_print;//////////////////////////////////////////////////////////////////////////////
//	Event:			pfc_print
//	Arguments:		None
//	Returns:			Integer - 1 if it succeeds and -1 if an error occurs
//	Description:	Opens the print dialog to allow user to change print settings,
//						and then prints the DataWindow.
//////////////////////////////////////////////////////////////////////////////
//	Rev. History	Version
//						5.0   Initial version
//						5.0.01   Modified script to avoid 64K segment problem with 16bit machine code executables
//						5.0.04	Destroy local datastore prior to returning in error condition.
//////////////////////////////////////////////////////////////////////////////
//	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_rowselection
integer	li_rc
long		ll_selected[]
long		ll_selectedcount
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

// Print selection
if this.Object.DataWindow.Print.Page.Range = "selection" then
	// Get selected count
	lb_rowselection = IsValid (inv_RowSelect)
	if not lb_rowselection then of_SetRowSelect (true)
	ll_selectedcount = inv_RowSelect.of_SelectedCount (ll_selected)
	if not lb_rowselection then of_SetRowSelect (false)

	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
				destroy lds_selection
				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
datawindow.describe datawindow
datawindow.print datawindow
datawindow.rowscopy datawindow
datastore.modify datastore
datastore.print datastore
datastore.reset datastore
systemfunctions.isvalid systemfunctions
pfc_n_cst_dwsrv_rowselection.of_selectedcount pfc_n_cst_dwsrv_rowselection
pfc_u_dw.of_SetRowSelect pfc_u_dw
pfc_u_dw.pfc_printdlg pfc_u_dw

     
Full name
No Data

     
Name Scope
No Data