It seems that the html file has to be in “C:\lianja\apps\myapp” folder, then we can use that in the URL attribute of a webview section.

Can we use a html file that is in “c:\lianja\server\temp” folder as the URL source?


The URL has to reference a file below the wwwroot, so you could not use c:\lianja\server\temp. If you create a temp folder under wwwroot (C:\lianja\cloudserver\tenants\public\wwwroot\ is the default), then you could specify this folder in the tmpnam() function, e.g.

m.cFile = tmpnam("c:\lianja\cloudserver\tenants\public\wwwroot\apps\myapp\temp\",".htm")
m.htmlrep = "c:\lianja\cloudserver\tenants\public\wwwroot\apps\myapp\rpt_template.htm"
m.nResult=StrToFile(m.cStr, m.cFile)

return '/apps/myapp/temp/' + justfname(cFile)





In my webview, I’ve defined a hyperlink field (“hyperlinks=id”)

lib:/report.rsp?database=sfm&table=documenti&heading=Documenti aperti&fields=keylookup("Clienti", "id", keylookup("Progetti", "id", documenti.progettoid, clienteid), cliente),keylookup("Progetti", "id", documenti.progettoid, progetto),id,caso,priorita,descrizione,stato&headings=Cliente,Progetto,N Documento,Caso,Priorita,Descrizione,Stato&hyperlinks=id&gridlines=false

then I’ve flagged my “delagate hiperlink” and in the “delagate script”
Pagina_attivita_in_corso_Sezione_attivita_in_corso _linkclicked

then I’ve write my function:

// Event delegate for 'linkclicked' event
proc Pagina_attivita_in_corso_Sezione_attivita_in_corso_linkclicked(arg)
        // insert your code here
        m_filtro = "page:documento.documento_documento?action=search&text=" + arg
        ? "m_filtro = " + m_filtro

when I click on my hyperlink, the args is empty..

In the rsp file (backup the file if you are using the default lib:/report.rsp and remember that it will be overwritten by the installer) change the lines:


if len(target) > 0
        ?? ('&(space)' + m_link + '')
        ?? ('&(space)' + m_link + '')

Can I use Lianja.evaluate to set a value on a canvas section from a webview
I would like to set a textbox on a canvas section with that variable value.
Using Linja.evaluate(“page.section.object”), I can get the current value of the textbox like so

var p = Lianja.evaluate('Lianja.get("page1.section1.txt1").value');

However, I don’t seem to be able to set the value.

As this is desktop you can use Lianja.execute( )
Lianja.evaluate( ) is for evaluating expressions.
Lianja.execute( ) is for executing Lianja/VFP commands.
Note that the Lianja system object is system wide across all sections in an app so you can perform operations on any UI elements directly. You only need to reference them with Lianja.get( )

I’ve declared some variables to be used by the whole app in a JS page specified as the custom library in the app settings. Works totally fine accessing and mutating them from within pages, sections and so on. Now I’m building a webview section to display these variables in a nice, CSS’d format. Problem is, when I try to print the variables to the webview’s html with javascript, it’s telling me they aren’t declared. Obviously they are, so it’s not seeing the variables declared in the app’s custom library.

var myglobal = "abcd";

Name: Screenshot - 22.2.2017. , 8_49_58.png Views: 0 Size: 2.4 KB

s it even possible to access those variables from the javascript on a JSSP page?
Custom library code runs in the client.
WebViews have their own context although you can use the Lianja system object from any JavaScript that is generated and runs within that context.
Passing client side data to server pages should be done as parameters that should preferably be base64 encoded and if passing many of them added to an object which is JSON encoded on the client and JSON decoded on the server.
So to summarize. Considering a Webview is generated remotely it has no direct access to client side JavaScript variables.

If you are ever stuck in a webview section, right click it and use the inspector, it will let you know where your issue is.
If you are not sure how to use it, here is link that may be useful.

I’m tryng to create a HTML Editor server page.
I’ve created a page, with a WebView section, saved as a Server Page.

is possible to force the ControlSource of the webview section?

I’ve try with:

public Ps_ControlSource
Ps_ControlSource = "articoli.abbinamenti"
lianja.showdialog("EditorHTML", "EditorHTML")   
release Ps_ControlSource

then, in the Load of EditorHTML page:

section = lianja.get("section1")
value = Ps_ControlSource
section.ControlSource = value

but not work..
controlsource is a RW property of webview, but i I type:

a = lianja.get("EditArtCarTesto.section1")
? "-" + a.controlsource + "-"

I get: —

a = lianja.get("EditArtCarTesto.section1").webview


Remember that you can change the attributes of the section and also those of the UI element inside it so you need to reference the element contained within the section which is a container.

A Webview section in a desktop app is not connected to an http server.
Attempting to use a FileReader is only valid in a web browser client not a desktop app with an embedded Webview.
The desktop client has a web server running internally in port 8002

I’ve a difference from Webview and printed webview.

If I print with:
Webview.printpreview(GETPRINTER(), ‘PORTRAIT’, ‘NATIVE’, ”, ‘A4’, 1)
then print from the preview..
not work.
google this “a4 size in pixels” and experiment.

72 dpi (web) = 595 X 842 pixels
300 dpi (print) = 2480 X 3508 pixels (This is “A4” as I know it, i.e. “210mm X 297mm @ 300 dpi”)
600 dpi (print) = 4960 X 7016 pixels
Try generating as a “PDF” rather than “native”

also, you need to specify the output filename for the PDF file. Read the doc for WebView print()

Webview.print(GETPRINTER(), ‘PORTRAIT’, ‘PDF’, ‘c:\temp\schedaarticolo.pdf’, ‘A4’, 1)

In a desktop application, I have a web view section and a canvas section.
How can I reference an id in the webview section from the canvas section?
The WebView section has an evaluate() method which lets you execute JavaScript inside it.
evaluate() document.getElementById(‘name’).value;

access to the webview objects from outside the webview.

Meaning – If I want to change the innerhtml of an item in the webview from a canvas section how can that be accomplished.

I guess another way to ask the same question is what is the hierarchy of webview in the LOM/DOM

something like Lianja.page1.document.getElementById(“Title”).inne rHTML = “New Title!”;
reference to the WebView section in Lianja.

myview = Lianja.getElementByID(“page1.section1”).webview

If you define a JavaScript function in your WebView HTML using a