1. Arjun Sankar
  2. PowerBuilder
  3. Friday, 19 July 2019 06:14 AM UTC

Hello, We recently migrated from PowerBuilder 12.5 to 2017 and now notice that when we print any application reports (datawindows), the ‘Page Range’ section in the ‘Print Dialog’ box  is disabled. We use ‘PFC_Print’ function for the print and this was working fine in PowerBuilder 12.5. Attached relevant screenshots.

Note: We did not use the latest PFC libraries for PB 2017 version, instead we have been migrating the PFC libraries since version 5.

I came to know from Appeon community discussions (https://www.appeon.com/developers/get-help/knowledgebase/pfc-print-range-selection-disabled.html) that this is due to the usage of ‘pfccom32.dll’ in 'pfc_printdlg' function which is unsupported since version 8. However as I said above, it was working fine in 12.5 version.

Could you please advice a solution other than replacing all our migrated PFC libraries with the latest PFC libraries? Could we selectively use the PFC 2017 objects required for this print dialog box and import them into our migrated PB 2017 code? Please let us know.

*Reproduce Steps:
Call pfc_print() for a datawindow report from an application code with PFC libraries migrated from older versions (version 5 in our case)

 

Thanks,

Arjun.

Attachments (1)
John Fauss Accepted Answer Pending Moderation
  1. Thursday, 25 July 2019 00:37 AM UTC
  2. PowerBuilder
  3. # 1

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

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 24 July 2019 14:54 PM UTC
  2. PowerBuilder
  3. # 2

Hi Arjun;

    The PFC was "open Sourced" by Sybase in PB v10.0. Thus it was and is no longer controlled by Sybase, SAP or now Appeon. The link you listed is correct and the only "official" location for the PFC's.

Regards ... Chris

 

 

Comment
There are no comments made yet.
Arjun Sankar Accepted Answer Pending Moderation
  1. Wednesday, 24 July 2019 14:18 PM UTC
  2. PowerBuilder
  3. # 3

Hello all, is PFC2017 download available only from https://github.com/OpenSourcePFCLibraries? Is it available anywhere in Appeon site? Please advice.

Comment
  1. John Fauss
  2. Wednesday, 24 July 2019 14:34 PM UTC
That is the correct source for the PFC libraries, Arjun. The PFC is not an Appeon product.
  1. Helpful
There are no comments made yet.
Arjun Sankar Accepted Answer Pending Moderation
  1. Tuesday, 23 July 2019 09:10 AM UTC
  2. PowerBuilder
  3. # 4

Thanks Brad, Chris & David. I'm going to combine the suggestions from Brad and David and give it a try. I will update the results here. Thanks again.

Comment
There are no comments made yet.
David Peace (Powersoft) Accepted Answer Pending Moderation
  1. Monday, 22 July 2019 10:50 AM UTC
  2. PowerBuilder
  3. # 5

Hi Guys

The key issue is that this code worked in PB12.5 and does not in PB2017. These two version are not that far appart so I guess the real question is what the old PFC ultimately does in the PB script to open the print dialogue box.

Comparing this to later versions of PFC is a good start, to idenifiy any differences. However, ultimately it must be doing dw.print(false, true) or dw.print(true, true) at some point. The dialog option being controlled by the sencond boolean parameter. There are no option to supress selections so how is that happeneing?

Cheers

David

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 19 July 2019 13:45 PM UTC
  2. PowerBuilder
  3. # 6

Hi Arjun;

  When you migrated your application to PB2017 ... did you also replace the PFC layer objects with the PFC2017 version?

Regards ... Chris

Comment
  1. Brad Mettee
  2. Friday, 19 July 2019 13:56 PM UTC
Chris: they've been porting the PFC since PB5, so the haven't replaced anything with newer versions.



Arjun: You may want to reference the new PFC in regards to the printing functions to see what's different, and port those changes into your existing PFC. Anything else that's broken you can approach the same way.
  1. Helpful
  1. Chris Pollach @Appeon
  2. Friday, 19 July 2019 16:49 PM UTC
Thanks Brad .. I missed that in the original post. OMG .. there have been lots of PFC changes since PB 5.0!
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.