Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Syntax 

Code Block
collapsefalse
twebchanneldialog.jsToAdvpl( < codeType >, < codeContent > )

...

Code Block
languagecpp
themeEclipse
linenumberstrue
collapsefalse
// The ADVPL segment below creates the component TWebChannel and
// associated with the bJsToADVPL code block
oWebChannel := TWebChannel():New()
oWebChannel:bJsToAdvpl := {|self,codeType,codeContent| jsToAdvpl(self,codeType,codeContent) }

// Associates the port of compoent TWebChannel with component
// TWebEngine allowing the exchange of messages
oWebEngine := TWebEngine():New(oDlg,0,0,800, 600,,oWebChannel:nPort)

// JavaScript segment below send a signal notifying
// the end of HTML page/component
twebchanneldialog.jsToAdvpl("page_started", "Page started");

// ADVPL segment below is the function activated
// by the bJsToAdvpl block code upon receiving the JavaScript message
static function jsToAdvpl(self,codeType,codeContent)
  if codeType == "page_started"
    msgAlert(codeContent)
  endif
return