helper
field in your script. public void clicked() { XULWidget widget = helper.getCurrentWidget(); }
public class ScriptHelper |
---|
Modifier and Type | Method and Description |
---|---|
Object | evalScript(String method, Object... args)
Evaluate a script method
|
Object | evalScript(String method)
Evaluate a script method without arguments
|
ScriptContext | getContext()
Return the script context
|
XULDocument | getCurrentDocument()
Return the current document
|
XULWidget | getCurrentWidget()
Return the current widget
|
String | getText(File file)
Return the text associated with a text File
|
boolean | setText(File file, String text)
Set the text for a text File
|
evalScript(String method, Object... args)
andevalScript(String method)
methods will evaluate a method or function for any script referenced in the same XUL document as the script (for embedded scripts of external scripts).<window id="Hello" title="Hello" orient="horizontal" width="250" height="100" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script> function clicked(){ var value = compute(); alert('Hello World...' + value); } </script> <script> function compute(){ return 10; } </script> <button label="Push Me!" oncommand="clicked()" /> </window>
getCurrentDocument()
and getCurrentWidget()
will return the XUL document or widget from which originates the last event. It will return null before any event have been triggered.public void clicked() { XULWidget widget = helper.getCurrentWidget(); }
Copyright 2017-2020 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence