HTML5 Front-End Functions
Here are the built-in functions
implemented by the front end in the "html5" module:
Attention: The names of front-end functions and pre-defined
arguments are case-sensitive.
eval
Executes the JavaScript provided as the argument:
ui.Interface.frontCall("html5","eval", [text], [result])
text = text to be interpreted as JAVA script
result = variable which holds the results of the function execution
LyciaDesktop: yes
LyciaWeb: yes
fileinfo
Returns size, MIME type, and time of previous modification for any file specified as an argument:
ui.Interface.frontCall("html5","fileinfo", [file_name], [result])
file_name = name of the file in interest
result = variable which holds the results of the function execution
For
LyciaWeb, will work only if there is a TextField in the Lycia form with the FileUpload class.
LyciaDesktop: yes
LyciaWeb: yes
setLocalStorage
Sets the value specified as its second argument to the value of the HTML5 local storage by the name specified as its first argument:
ui.Interface.frontCall("html5","setLocalStorage", ["key","value"], [result])
key = name to be given to the HTML5 local storage
value = value set for the HTML5 local storage with the given name
result = variable which holds the results of the function execution
LyciaDesktop: yes
LyciaWeb: yes
Usage and examples (click to open)
ui.Interface.setLocalStorage()
is used to store data on the client side.
Example:
MAIN
DEFINE f1,i INT
DEFINE getstor DYNAMIC ARRAY OF CHAR(10)
DEFINE tstor DYNAMIC ARRAY OF CHAR(10)
FOR i = 1 to 10
LET tstor[i] = "string",trim(i)
END FOR
CALL ui.Interface.frontCall("html5", "setLocalStorage", ["temp_stor.str",tstor], f1)
CALL ui.Interface.frontCall("html5", "getLocalStorage", ["temp_stor.str"], getstor)
DISPLAY getstor
CALL ui.Interface.frontCall("html5", "setLocalStorage", ["temp_stor.str",tstor[1]], f1)
CALL ui.Interface.frontCall("html5", "getLocalStorage", ["temp_stor.str"], getstor)
DISPLAY getstor
CALL FGL_GETKEY()
END MAIN
In
the example below, ui.Interface.setLocalStorage()
saves a theme snippet in the local storage so that this snippet can be
used for creating an application theme by concatenation:
CALL ui.Interface.frontCall("html5", "setLocalStorage",
["my_theme_snippet","<?xml version=\"1.0\" encoding=\"utf-8\"?> <StyleSheet
xmlns=\"http://querix.com\"> <ElementFilter ElementName=\"Label\"> <StyleSheet> <DoStyleAction> <SetProperty> <PropertyPath> <PropertyName>Background</PropertyName> <PropertyName>FillColor</PropertyName> </PropertyPath> <PropertyValue
type=\"CustomizedColor\" RedColor=\"173\" GreenColor=\"255\"
BlueColor=\"47\" Alpha=\"255\" /></SetProperty> </DoStyleAction> </StyleSheet> </ElementFilter> </StyleSheet>"],
[res])
getLocalStorage
Returns values stored in the HTML5 local storage by the name specified as an argument:
ui.Interface.frontCall("html5","getLocalStorage", [key], [result])
key = name of the HTML5 local storage
result = variable which holds the results of function execution
LyciaDesktop: yes
LyciaWeb: yes
styleImport
Imports CSS styles by URL:
ui.Interface.frontCall("html5","styleImport", ["url","copy", id], [])
url = URL of the imported style
copy (optional) = specifies whether the imported style must be copied to native window context for LyciaDesktop
id (optional) = identifier for the imported style
Any URL pattern can be used, including qx:// <> to access files which are already part of the project.
LyciaDesktop: yes
LyciaWeb: yes
scriptImport
Imports script files by URL:
ui.Interface.frontCall("html5","scriptImport", ["url","nowait"], [])
url = URL of the imported script
nowait(optional) = specifies whether the function should exit immediately without waiting for the successful script uploading
Any URL pattern can be used, including qx:// <> to access files which are already part of the project.
LyciaDesktop: yes
LyciaWeb: yes
htmlImport
Imports HTML5 WebComponents.
A new experimental HTML importing facility currently not supported by browsers, so it is unlikely that it will work properly unless some simulation libraries are loaded.