1. appeon pb
  2. PowerBuilder
  3. Thursday, 17 August 2023 10:08 AM UTC
controlname.EvaluateJavascriptSync (string script{, ref string result{, ref string error}}) 

pb help:
script --- The JavaScript to be evaluated. The JavaScript cannot have statements that show dialog boxes.
If a dialog box must be displayed in JavaScript, the script must be executed asynchronously.

I call EvaluateJavascriptSync with script that not have statement that show any dialog boxes,
but webbrowser stucked .

my js code like this:

wb_1.Navigate('xxx.html') // xxx.html have a fun uf_editor_init
function uf_editor_init(_lineheight, _fontfamily, _fontsize, _avoid) {
           
            var avoid = false;
            if("undefined" == typeof _avoid){
                avoid = false;
            }
            else {
                avoid = _avoid;
            }
         
            editor = UE.getEditor('editor', {
                allowDivTransToP: false,
                avoidCssConflict: avoid,
                initialStyle: '.ue_edit p{font-family:'     + _fontfamily + ';font-size:' + _fontsize + 'px;color:black;}'
            });
           
            editor.ready(function () {
                if (is_ready === 'n') {
                    is_ready = 'y';
                    window.location.href = 'ready.html';
                }
            })
           
           
            editor.addListener('contentChange', function () {
                is_modified = 'y';
               
            })
        }
 
After load the page,when i call 
wb_1.EvaluateJavascriptSync('uf_editor_init(......)'), PB stucked.
 
 
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Friday, 18 August 2023 19:33 PM UTC
  2. PowerBuilder
  3. # 1

Hi, This might be a bug so please open a support ticket: https://www.appeon.com/standardsupport/newbug

 

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Saturday, 19 August 2023 23:40 PM UTC
  2. PowerBuilder
  3. # 2

Have you tried using EvaluateJavaScriptAsync? If not, I suggest you try it.

Although you have not described what action(s) you are performing in JavaScript, the code snippet you posted leads me to believe that you are opening/using an editor of some kind. I know the documentation says to not use EvaluateJavaScriptSync when a dialog box will be opened, but I believe the critical concern has to do with initiating an action that writes to the screen/display in any manner, not limited solely to a dialog box. I say this because of my experience with learning about using Apache Echarts from PB and adapting the Appeon-supplied charting example application for use in our product.

The charting example utilizes EvaluateJavaScriptAsync in order to accomplish what needs to be done, so it makes me think this might be the cause of the problem. Worth a try, in my estimation.

Best regards, John

Comment
  1. Chris Pollach @Appeon
  2. Sunday, 20 August 2023 00:25 AM UTC
There was a similar bug opened in the 2022 R2 "beta" that has been fixed in the PB 2022 R2 official release. Not sure though what version / build of PB that you're using as this was not stated.
  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.