1. Toan Nguyen
  2. PowerBuilder
  3. Monday, 29 July 2024 15:51 PM UTC

Hello All,

I am trying to use the new Web Browser control to display HTML information in PB2022R3.

I have attached a zip file for the sample application to just open a response window to display HTML

I have tried the scripts below in both the Open event and user-defined 'ue_postopen' event to attempt to display the HTML but nothing displayed in the WB control after the open of the window.

string ls_html

Integer li_rtn

wb_1.Resize(this.width - 100, this.height - 400)

wb_1.visible = true

ls_html = '<HTML><BODY>ARMED: N RACE: W HGT: 67 WGT: 165 EYES: BR HAIR: BR<BR/>    UPDATE 2010-10-18 Miscellaneous Identifying Number: AR-A028120241</BODY></HTML>'

li_rtn = wb_1.NavigateToString(ls_html)

 

The only way I can make it display the HTML is upon opening the window, I have to click on a commandbutton control (Show HTML) that have the above scripts.

Since I am not knowledgeable about the new WB control, is there a way to display information in the window without user's action?

Currently, the application uses the MS web browser OLEObject to display information when the window opens. So, we want to use WB control in place of the OLEOject.

Please take a look of my attached sample application and let me know how I can use the WB control to display HTML.

Thank you very much in advance,

Toan Nguyen

 

 

Attachments (1)
Toan Nguyen Accepted Answer Pending Moderation
  1. Wednesday, 31 July 2024 12:58 PM UTC
  2. PowerBuilder
  3. # 1

Hi Kai,

Just want to let you know that I tried your suggestion and it didn't work.

It doesn't look like the scripts in the web browser's navigationcompleted event gets executed at all. Therefore, scripts in ue_postopen event, calling NavigateToString() to display HTML string didn't happen.

Thanks,

Toan


Comment
  1. Kai Zhao @Appeon
  2. Thursday, 1 August 2024 00:43 AM UTC
Did you test it with my attached object? If you use your original example, please comment the line 'li_rtn = wb_1.NavigateToString(ls_html)' in the open event of w_use_wb.
  1. Helpful
There are no comments made yet.
Kai Zhao @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 30 July 2024 03:00 AM UTC
  2. PowerBuilder
  3. # 2
Hi Toan,
 
We reproduced it on our end, and we will do further research to figure it out and keep you posted about the progress. 
 
Please try working around the issue with steps below. Please refer to attached object for more detail.
1 Add an instance variable: boolean ib_NavigateToString = false
2 Set the DefaultUrl of WebBrowser control to 'about:blank'
3 Add script like below in navigationcompleted event of the WebBrowser control.
 
if not ib_NavigateToString then
                ib_NavigateToString = true
                parent.PostEvent('ue_postopen')
end if
 
Regards,
Kai

 

Attachments (1)
Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Monday, 29 July 2024 22:02 PM UTC
  2. PowerBuilder
  3. # 3

Hi,

I've tried your app on pb2022 3356 and indeed, NavigateToString() does not seem to work from the open or ue_postOpen().

I think you should report this as a bug: https://documentation.appeon.com/standardsupport/newbug

When you write the html to an html file and use the good old Navigate() function, then it does work, even from the Open() event. (Example: wb_1.Navigate( 'file:///' + 'C:/pb_code/UO_Apps/UO_Apps/htmlfile.html' ) )

regards.

Comment
There are no comments made yet.
Toan Nguyen Accepted Answer Pending Moderation
  1. Monday, 29 July 2024 19:23 PM UTC
  2. PowerBuilder
  3. # 4

Hello All,

More on the web browser control's displaying issue that I am experiencing. 

If I run the sample application in Debug mode and step past the below script (last line) in the 'Show HTML' commandbutton then the HTML information is displayed in the control:

li_rtn = wb_1.NavigateToString(ls_html) 


So, it seems like loading or something relating to timing since it works in Debug mode.

Any suggestions to this issue is greatly appreciated!

Thanks,

Toan

 

 

Comment
  1. Toan Nguyen
  2. Tuesday, 30 July 2024 14:14 PM UTC
Hi Miguel and Kai,



Thank you for looking into my issue.



Miguel - Yes, using Navigation() to an HTML file works. I do use this method when I have a big blob of HTML data (multiple pages). However, in this situation, I know the HTML data is minimal ( < 200 characters), so I thought calling NavigationToString() is more efficient in both reducing overheads and better performance.



Kai - I will try your work-around suggestion and see if it works.



Once again, thank you both!



Regards,



Toan
  1. Helpful 1
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.