The code in the pfc_print event of the 2017 version of the PFC's pfc_u_dw object is shown below. Note there has been no documented changes to this event script since PB version 10. You can compare this code to the code in the version you are using to determine what has changed.
//////////////////////////////////////////////////////////////////////////////
// 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.
// 8.0 Return code of pfc_printdlg has changed for Cancel Action. Changed
// code to test on success rather than failure.
// 8.0 Set Printer chosen in print dialog
// 10.0 Use new overloaded function dw.Print(canceldlg, showPrintDlg) which could display Print Dialog,
//////////////////////////////////////////////////////////////////////////////
/*
* Open Source PowerBuilder Foundation Class Libraries
*
* Copyright (c) 2004-2017, All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted in accordance with the MIT License
*
* https://opensource.org/licenses/MIT
*
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals and was originally based on software copyright (c)
* 1996-2004 Sybase, Inc. http://www.sybase.com. For more
* information on the Open Source PowerBuilder Foundation Class
* Libraries see https://github.com/OpenSourcePFCLibraries
*/
//////////////////////////////////////////////////////////////////////////////
boolean lb_rowselection
integer li_rc
long ll_selected[]
long ll_selectedcount
long ll_cnt
string ls_val
datastore lds_selection
// 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
end if
end if
// Print
if IsValid (lds_selection) then
li_rc = lds_selection.Print (true, true)
destroy lds_selection
else
li_rc = this.Print (true, true)
end if
return li_rc
I am using this code/object along with the rest of the PFC 2017 libraries in a Windows application in PB 2017 R2 running in both Win7 & Win10 with no issues. The print page selection option is available and works flawlessly.
HTH