KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Approaches to rendering the Web Area when using the Blink engine on different form pages
PRODUCT: 4D | VERSION: 16R | PLATFORM: Mac & Win
Published On: December 14, 2017

To render a Web Area page when a content is set by using the command WA SET PAGE CONTENT (with the Blink engine), the WA OPEN URL must be called. After the WA OPEN URL command is called, a given amount of time is required to load the page in order to change content with WA SET PAGE CONTENT upon entering a form page. Here are some approaches to render a Web Area on immediately selecting a form page:

1. Setting the Web Area in page 0 off screen:



By setting the Web Area offscreen on page 0, the WA OPEN URL can be called initially that will allow WA SET PAGE CONTENT to be called upon entering a form page. An example would be to use a button to go to another page with FORM GOTO PAGE. Keep in mind that the Web Area object would have to be moved to that page and off using OBJECT SET COORDINATES.

2. Using Timer upon entering the form page:

Using SET TIMER when the form event "On Timer" is checked, allows the follow code below to execute setup the Web Area with content as shown below in a button:

FORM GOTO PAGE(2)

webAreaContent:="<html><body><h1>Hello Web Area1!</h1></body></html>"

If (WA get page content(*;WebArea1")="")
 WA OPEN URL(*;"Web_Area1";"_blank")
 SET TIMER(10)
Else
 WA SET PAGE CONTENT(*;"Web_Area1";webAreaContent;"file:///")
End if

Once the Web Area is setup, web content in webAreaContent variable can be loaded shown in the Else clause.

On the form event of "On Timer" of the form object method code, WA SET PAGE CONTENT can be set as shown below:

Case of
  : (Form event=On Load)
  C_TEXT(webAreaContent)

  : (Form event=On Timer)
  WA SET PAGE CONTENT(*;"Web_Area1";webAreaContent;"file:///")
  SET TIMER(0)
End case

This area should only be ran once after the Web Area has been setup.

Both approaches can produce the same result as shown below: