KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Create a dynamic form with a Web Area
PRODUCT: 4D | VERSION: 16R6 | PLATFORM: Mac & Win
Published On: August 3, 2018
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

Here is a utility method to open a specified URL with a dynamic form containing a Web Area:

// -----------------------------------------------------------------
// Name: CREATE_DYNAMIC_FORM_WEBAREA
// Description: Method will create a form with a Web Area object
// and display the URL specified.
//
// Input Parameters:
// $1 (LONGINT) - Left coord in the form for Web Area object
// $2 (LONGINT) - Top coord in the form for Web Area object
// $3 (LONGINT) - Width size in pixels for Web Area object.
// $4 (LONGINT) - Height size in pixels for Web Area object.
// $5 (TEXT) - URL to open with Web Area.
// ------------------------------------------------------------------
C_LONGINT($1;$left;$window)
C_LONGINT($2;$top)
C_LONGINT($3;$width)
C_LONGINT($4;$height)
C_TEXT($5;$webAddr;webAddr)
C_OBJECT($wa;$page;$form)


If (Count parameters=5)
  $left:=$1
  $top:=$2
  $width:=$3
  $height:=$4
  $webAddr:=$5
  webAddr:=$webAddr
  
  $wa:=New object("type";"webArea";"text";"webArea";"top";$top;"left";$left;\
  "width";$width;"height";$height;"sizingX";"grow";"sizingY";"grow";\
  "webEngine";"embedded";"method";"CREATE_DYNAMIC_FORM_WEBAREA";"events";New collection("onLoad"))
  
  $page:=New object("objects";New object("webArea";$wa))
  $form:=New object("pages";New collection(Null;$page);"windowTitle";$webAddr)
  
  $window:=Open form window($form)
  DIALOG($form)
  CLOSE WINDOW($window)
Else
  
  If (Form event=On Load)
   WA OPEN URL(Self->;webAddr)
  End if
End if


Here is an example of opening "www.4d.com":

CREATE_DYNAMIC_FORM_WEBAREA (0;0;800;600;"http://www.4d.com")





See Also: