| Purpose | When you call a JavaScript function using CallJS, a global "guixt" object is already defined (in IE mode) or can be retrieved using "let guixt = window.guixthost". It provides easy access to GuiXT script variables and offers several useful functions, such as the ability to execute a GuiXT script from JavaScript.
The same object is passed
to an HTML page by
connectHTML:
the function guixt_initialize(obj) is called up (if
found in the HTML page), passing the guixt object: JavaScript
If the HTML page was displayed with
WebView, you can use the object "guixthost" directly and do without the function guixt_initialize(). A call to
connectHTML is nevertheless necessary.
Component "GuiXT Controls" is
needed for this feature. |
| Get() |
r = guixt.Get(var) If the content of var is "xxx", the GuiXT script variable V[xxx] is read and its content is stored into r. Example:
menu_icon_path = guixt.Get("menu_icon_path"); |
| Set() |
guixt.Set(var,value) If the content of var is "xxx", the GuiXT script variable V[xxx] is set to the content of value. Example:
guixt.Set("menu_icon_path",
"C:\guixt\menu\icons");
Table and structure variables Example:
// GuiXT script: CreateTable V[customers] account name city The column structure defined with CreateTable is kept: columns that are missing in the JSON objects remain empty, additional properties are ignored. There is no size limit. The JSON conversion is fast even for large tables, so there is no need to use long text variables (SetText) instead.
Changed variables and the SAP screen
|
| GetText() |
r = guixt.GetText(var)
If the content of var is "xxx",
the GuiXT long text variable text[xxx] is read and its content is
stored into r. |
| SetText() |
guixt.SetText(var,value)
If the content of var is "xxx",
the GuiXT long text variable text[xxx] is set to the content of value. |
| Value() |
r = guixt.Value(var) GuiXT replaces all &-expressions in the given string, applying the usual GuiXT logic, and stores the result into r. Example:
mat = guixt.Value("&F[Material]"); |
| Input() |
guixt.Input(s) The given string is interpreted as input to SAP GUI entry fields, together with a function code and optionally an InputScript, as described in the input= option of the Image command. Example:
guixt.input("U[VBELN]:" + ListView.selectedItem);
Pressing Enter
guixt.Input("OK:/0");
// Enter "OK:?" corresponds to Enter "?" in an InputScript (see Enter). Use it when you only need a new screen round trip, e.g. to display variables changed by JavaScript. |
| Process() |
guixt.Process(funcname, par1, par2, ...)) Corresponds to the GuiXT instruction Process. From the first parameter funcname the script name "process_[funcname].txt" is formed. This script is executed, whereby the parameters of the script are occupied by the values of par1, par2,... . The string set at "Return" in the script is returned. address = guixt.process("customeraddress", "K1032"); Example: JavaScript
|
| FilePath() |
guixt.FilePath(s, [cache=True]) The given string is interpreted as file name within the current GuiXT script folder.
If cache=True is specified, external files are first searched in the GuiXT cache. Example:
imgpath = guixt.FilePath("images\home.gif")
imgpath = guixt.FilePath("http://www.synactive.com/images/s10logo_blue.gif") |
| SetEventHandler() |
guixt.SetEventHandler(obj1,obj2) You specify two objects. For each event, e.g. "Click", of obj1 the corresponding function "On...", e.g. "OnClick", of obj2 is called. The event parameters are passed to the function according to the event's interface specification; you have to define a matching number of function parameters. In most cases obj1 will be a given control , e.g. a List View, and obj2 will be an object that you have specifically defined for event handling. The GuiXT trace function can display all raised events with their actual parameters as soon as a (maybe still empty) event handler object is set. |
| DoEvents() |
guixt.DoEvents() The function waits a few milliseconds and then processes all Windows messages from the message queue. You need this function for controls that work with asynchronous processing. For example, the Internet Explorer control loads html pages asynchonously, and before you can access a new page you have to interrupt your own program with DoEvents() until the page has been loaded. |
| CreateObject() |
guixt.CreateObject(progid) Creates an ActiveX object and returns a reference to it. Example:
let XXL = guixt.CreateObject("Excel.Application"); |
| GetObject() |
guixt.GetObject(progid) Returns a reference to an existing registered object provided by an ActiveX component. Example: let XXL = guixt.GetObject("Excel.Application"); |