1. Miguel Leeuwe
  2. PowerBuilder
  3. Friday, 7 January 2022 04:55 AM UTC

Hi,

I've created a ticket, asking Appeon for clear documentation on valid PB.INI entries: https://www.appeon.com/standardsupport/search/view?id=7750
That might take a while though.

So what I've done, is create a little Google-Site (you may laugh, my skills are close to zero). Maybe someday it will turn into a real website :)

This is the site: PB.INI entries

  • There's a menu entry that say "PB.INI".
  • It has a submenu to list all entries I've been able to scrape together from Q&A's and tickets (most of the information comes from Chris Pollach, thank you Chris for all the good work!). I've tried to exclude any entries that are now considered obsolete or seemed obsolete to me.
  • There's another submenu to enter any new entry that's missing and you might know anything about.
    Please feel free to indicate any incorrect or missing information.

Some of the entries are not very well documented and I'm open to any suggestions.

I hope it can be useful to anyone.

regards

 

Accepted Answer
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Saturday, 22 January 2022 18:43 PM UTC
  2. PowerBuilder
  3. # Permalink

Well, my ticket's got status "transferring" and Armeen has confirmed it will be documented, so I'm marking this as resolved.

Thanks to everyone!

Comment
There are no comments made yet.
Simone Olianti Accepted Answer Pending Moderation
  1. Monday, 7 February 2022 11:37 AM UTC
  2. PowerBuilder
  3. # 1

Not sure if this is happening only to me or not but i've noticed a strange behaviour when using

[DataStore Behavior]
UseHwnd=no

if i enable this on my pb.ini and starting my app from a compiled .EXE i'm getting trouble accessing a remote datastore using RestClient
no idea why

Example:
RESTClient inv_RestClient
inv_RestClient = CREATE RESTClient
inv_RESTClient.SetRequestHeader ("Content-Type", "application/json;charset=UTF-8")
inv_RestClient.Setrequestheader( "Accept-Encoding", "gzip")

datastore dss
dss = create datastore
dss.dataobject='dss_startreg_new_find'

ls_Request_Url = ls_url+"startregnewfind/Retrieve?codaz=" + ls_codaz
inv_RestClient.retrieve(dss, ls_Request_Url)
if dss.rowcount( ) > 0 then
    messagebox("SUCCESS!", "")
else
   messagebox("FAILED!", "")
end if
destroy dss
destroy inv_RestClient

if i put the "[DataStore Behavior] UseHwnd=no" in the pb.ini the retrieve always failing. If i remove it or set UseHwnd=yes, it works

just wanted to report this in case someone else experiencing same issue and, in case, to update the very useful documentation by Miguel
 
Comment
  1. Simone Olianti
  2. Tuesday, 15 February 2022 08:08 AM UTC
i can confirm that using httpclient and then importing into the datastore is working even with the "UseHwnd=no" option.

So looks like it is affecting only the restclient approach
  1. Helpful 2
  1. Armeen Mazda @Appeon
  2. Tuesday, 15 February 2022 14:25 PM UTC
Hi Simon, Can you please open a support ticket and provide small test case. Our engineers will investigate if this is a bug or feature enhancement, and also we will consider resolving in future version. Thanks.
  1. Helpful
  1. Simone Olianti
  2. Tuesday, 15 February 2022 14:40 PM UTC
Hi Armeen, will do it as soon as possible for sure
  1. Helpful
There are no comments made yet.
Mark Goldsmith Accepted Answer Pending Moderation
  1. Monday, 10 January 2022 16:04 PM UTC
  2. PowerBuilder
  3. # 2

Thanks for initiating this Miguel. Not to be too pessimistic, lol, as I'm generally an optimist but I'm only somewhat hopeful we'll receive this documentation. Others, also with long and storied contributions to the community as well as some with MVP status, haven't been too successful when they've posted about the need for this information to be made available. I think the response has always been about the amount of time and effort it would take to find and document all this information...but here's hoping with your support ticket they'll finally assign someone to make this happen!

While some settings may be obvious, I think it would also be helpful to identify these settings as to their applicability, that being the development environment, deployed app or both.

Thanks again for requesting this and for setting up the website!

Regards...Mark

Comment
  1. Armeen Mazda @Appeon
  2. Saturday, 22 January 2022 16:14 PM UTC
We will add this info to the documentation. Miguel, thanks for taking the initiative and your help!
  1. Helpful 1
  1. Mark Goldsmith
  2. Saturday, 22 January 2022 16:48 PM UTC
Thanks Armeen for confirming this will be provided...I think it will be very helpful going forward.
  1. Helpful
  1. Miguel Leeuwe
  2. Saturday, 22 January 2022 18:39 PM UTC
yw Armeen!
  1. Helpful
There are no comments made yet.
Benjamin Gaesslein Accepted Answer Pending Moderation
  1. Friday, 7 January 2022 11:03 AM UTC
  2. PowerBuilder
  3. # 3

What you need to work around the print bug when setting UseHwnd to No:

w_printdummy - just an empty Window object with the visible flag set to false (and minimize fo safety :) ), nothing else. I inherited from PFC's w_master but any kind of window should do.

forward
global type w_printdummy from w_master
end type
end forward

global type w_printdummy from w_master
boolean visible = false
windowstate windowstate = minimized!
end type
global w_printdummy w_printdummy

on w_printdummy.create
call super::create
end on

on w_printdummy.destroy
call super::destroy
end on

u_dw_printdummy - this is used to display the proper print dialog to the user and thus get the proper print specs. Inherited from PFC's u_dw. Full source code:

forward
global type u_dw_printdummy from u_dw
end type
end forward

global type u_dw_printdummy from u_dw
end type
global u_dw_printdummy u_dw_printdummy

type variables
private:
	boolean ib_usercancelled = true
end variables

forward prototypes
public function long of_printsetup (long al_pages)
end prototypes

public function long of_printsetup (long al_pages);/////////////////////////////////////////////////////////////////////////
//
// Display print dialog to set print specs needed for Datastore printing
//
/////////////////////////////////////////////////////////////////////////
long ll_rc
this.modify ( 'datawindow.print.preview=yes' )
do
	// Insert rows until pagecount is the same as source DS. 
	// This is needed so the user can set the desired pages in the print dialog.
	this.insertrow( 0 )
  // I have not encountered an issue with this so far but There may be
  // a need for  safeguarding against a potential infinite loop here.
  // To be safe, maybe add a counter variable and exit the loop
  // when an implausibly high loop count is hit.
loop while long ( this.describe ("evaluate('pagecount()'," + string ( this.rowcount() ) + ")")) < al_pages
this.modify ( 'datawindow.print.preview=no' )

// We only want the print dialog to set all the specs to the DW so printing is cancelled
// immediately in printstart(). Therefore print() itself will *always* return -1 here.
// In order to still correctly identify the user pressing "Cancel" during the print dialog, this flag is set to true.
// If it wasn't reset to false in printstart(), we know that the dialog was cancelled by the user.
ib_usercancelled = true
this.print( true, true )
if not ib_usercancelled then
  // continue printing the DS
	ll_rc = 1
else
  // dialog was cancelled by user, return -1 accordingly
	ll_rc = -1
end if
// reset flag to default
ib_usercancelled = true
return ll_rc
end function

on u_dw_printdummy.create
call super::create
end on

on u_dw_printdummy.destroy
call super::destroy
end on

event printstart;call super::printstart;/////////////////////////////////////////////////////////////////////////
//
// Cancel print immediately.
// At this point the print dialog was OK'd so set ib_usercancelled to false
// 
/////////////////////////////////////////////////////////////////////////
ib_usercancelled = false
this.printcancel( )

end event

 

Then you need to override your base Datastore userobject's pfc_print event and add an additional function of_printsetup. To make this work even with non-PFC applications, I guess the print-function itself could be overridden but you'd still need to have a custom datastore objects as a base for all your datastores. A plain datastore will not print properly.

pfc_print:

event pfc_print;/////////////////////////////////////////////////////////////////////////
//
// Overridden, workaround for when UseHwnd is No
//
/////////////////////////////////////////////////////////////////////////
long ll_rc
// I've added a flag to use the regular print event
if ib_printlegacy then
	ll_rc = super::event pfc_print()
else
  // call method that displays print dialog and sets the specs
	ll_rc = this.of_printsetup( )
	if ll_rc > 0 then 
    // print silently
		ll_rc = this.print( false, false ) 
	end if
end if
return ll_rc

of_printsetup:

private function long of_printsetup ();/////////////////////////////////////////////////////////////////////////
//
// Opens dummy window to show regular print dialog. Gets print specs and
// sets them via modify
//
/////////////////////////////////////////////////////////////////////////
u_dw_printdummy ldw_dw
w_printdummy lw_dummy
long ll_rc
long ll_pagecount

//Use print preview to get current pagecount
this.modify ( 'datawindow.print.preview=yes' )
ll_PageCount = long ( this.describe  (  "evaluate('pagecount()', 1)"  )  )
this.modify ( 'datawindow.print.preview=no' )

// Open dummy window and have it open the dummy DW
Open(lw_dummy)
ldw_dw = create u_dw_printdummy
lw_dummy.openuserobject( ldw_dw )
ldw_dw.dataobject = this.dataobject
// call function that displays the dialog 
ll_rc = ldw_dw.of_printsetup(ll_PageCount)

// get print specs from DW and set them to this DS via modify
if ll_rc > 0 then 
	this.Modify("DataWindow.Print.Orientation= '" + ldw_dw.describe("DataWindow.Print.Orientation") + "'")
	this.Modify("DataWindow.Print.Copies= '" + ldw_dw.describe("DataWindow.Print.Copies") + "'")
	this.Modify("DataWindow.Print.DocumentName= '" + ldw_dw.describe("DataWindow.Print.DocumentName") + "'")
	this.Modify("DataWindow.Print.Duplex= '" + ldw_dw.describe("DataWindow.Print.Duplex") + "'")
	this.Modify("DataWindow.Print.FileName= '" + ldw_dw.describe("DataWindow.Print.FileName") + "'")
	this.Modify("DataWindow.Print.Margin.Bottom= '" + ldw_dw.describe("DataWindow.Print.Margin.Bottom") + "'")
	this.Modify("DataWindow.Print.Margin.Left= '" + ldw_dw.describe("DataWindow.Print.Margin.Left") + "'")
	this.Modify("DataWindow.Print.Margin.Right= '" + ldw_dw.describe("DataWindow.Print.Margin.Right") + "'")
	this.Modify("DataWindow.Print.Margin.Top= '" + ldw_dw.describe("DataWindow.Print.Margin.Top") + "'")
	this.Modify("DataWindow.Print.Page.Range= '" + ldw_dw.describe("DataWindow.Print.Page.Range") + "'")
	this.Modify("DataWindow.Print.Page.RangeInclude= '" + ldw_dw.describe("DataWindow.Print.Page.RangeInclude") + "'")
	this.Modify("DataWindow.Print.Paper.Size= '" + ldw_dw.describe("DataWindow.Print.Paper.Size") + "'")
	this.Modify("DataWindow.Print.Paper.Source= '" + ldw_dw.describe("DataWindow.Print.Paper.Source") + "'")
	this.Modify("DataWindow.Print.PrinterName= '" + ldw_dw.describe("DataWindow.Print.PrinterName") + "'")
	this.Modify("DataWindow.Print.Prompt= '" + ldw_dw.describe("DataWindow.Print.Prompt") + "'")
	this.Modify("DataWindow.Print.Quality= '" + ldw_dw.describe("DataWindow.Print.Quality") + "'")
	this.Modify("DataWindow.Print.Scale= '" + ldw_dw.describe("DataWindow.Print.Scale") + "'")
	this.Modify("DataWindow.Printer= '" + ldw_dw.describe("DataWindow.Printer") + "'")
end if
//Close dummy DW and window
lw_dummy.closeuserobject( ldw_dw )
close(lw_dummy)

return ll_rc

 

Comment
  1. Miguel Leeuwe
  2. Sunday, 9 January 2022 12:53 PM UTC
Well okay, I've forked the PFC's of 2021, made very similar changes as suggested by Benjamin and commited, pushed and then created a pull request, so that Bruce might (or not) accept the changes for the PFCs.

https://github.com/OpenSourcePFCLibraries/2021/pull/3

I've also created a ticket for the help on printing datastores not being fully correct: https://www.appeon.com/standardsupport/search/view?id=7764

Once again, Thank you very much Benjamin and everyone who responded!

regards
  1. Helpful 2
  1. Miguel Leeuwe
  2. Saturday, 22 January 2022 04:03 AM UTC
All done. The changes have been incorporated in the latest version for the pfc 2021. With thanks to Bruce!
  1. Helpful
  1. Miguel Leeuwe
  2. Saturday, 22 January 2022 04:07 AM UTC
So Benjamin, since I've incorporated your changes into the PFC 2021, now - if you have UseHwnd=No - all you would have to do is add a call like this in the constructor event of n_ds:

of_setLegacyPrint(False)



... and you could get rid of your own code, since I've incorporated all of it :)

regards.
  1. Helpful 2
There are no comments made yet.
Benjamin Gaesslein Accepted Answer Pending Moderation
  1. Friday, 7 January 2022 09:54 AM UTC
  2. PowerBuilder
  3. # 4

Hi Miguel,

this is a good idea!

Suggested addition for UseHwnd: setting this to "No" will break print functionality for Datastores. Specifically, print (true, true) [which is called by pfc_print if you're a PFC user] will no longer show the regular print dialog for Datastores. It's something you should know before using it. The performance gain is incredible so I built a workaround by overriding the pfc_print event of n_ds but it's a little complicated and involves opening an invisible dummy window which in turn opens a dummy datawindow as a userobject that is used to display the print dialog and get the print specifications for the DS.

There may be other side effects but this is the one I found because we use the DS print function extensively.

Comment
  1. Miguel Leeuwe
  2. Friday, 7 January 2022 10:18 AM UTC
Hi Benjamin, that's very useful information. I'll add it as an advertisement to the setting!

Would it be a lot of work to share your workaround? I mean you have given all of the details, but maybe it's something we could implement in the pfc classes themselves?

regards.
  1. Helpful
  1. Benjamin Gaesslein
  2. Friday, 7 January 2022 10:24 AM UTC
Sure, I could share the code. Will do so in a separate reply to this discussion so I can use the code tags.
  1. Helpful 2
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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.