Angel --- here is some information you can include at
http://jmol.sourceforge.net/jslibrary/
jmolSetCallback
jmolSetCallback(callbackName,functionName)
Sets the JavaScript function to be called by Jmol for the specified
callback type, as listed below. In each case, the first parameter
returned to functionName is the applet HTML name (usually
"jmolApplet0"), and the second parameter holds the information. If the
functionName is "alert" then just the second parameter is sent to the
user via a JavaScript alert() call, and no additional function on the
webpage is necessary. Callback functions can also be set anytime after
Jmol applet loading using the "set xxxxCallback" command, where "xxxx"
is one of "animFrame", "hover", "loadStruct", "message", or "pick"
animFrameCallback
called: when the frame is changed when multiple files are loaded into
different frames or a loaded file has multiple models.
return value: the frame index number (starting with 0)
note: This function will be called four times during successful file
loading but only three times if file loading was unsuccessful. Note that
the frame index number is not the number that one would use in the
"frame" command. Frame index 0 is always the first frame, 1 the next,
etc. If multiple files have been loaded, the third frame in the first
file has index 2 but is accessed in scripts by "frame 1003".
loadStructCallback
called: upon successful file loading
return value: the URL of the loaded file
note: When multiple files are loaded with the same load command, only
the URL of the last-loaded file is returned.
messageCallback
called: whenever a Jmol status message is generated.
return value: the status message
note: Messages are generated:
1) by the "message" script command
2) by the "echo" script command (even if no message is displayed)
3) by the "history", "show", and "getProperty" script commands
4) by the "connect" script command
5) by the "set xxxxCallback" script command, if "xxxx" is not one of
"animFrame", "hover", "loadStruct", "message", or "pick"
6) by user measuring, provided "set picking measure" has been issued
7) when the user has picked the first atom, provided "set picking spin"
has been issued
8) whenever the number of selected atoms is changed
9) due to errors during the execution of various commands, including
"pmesh", "set",
10) upon script completion ("Script completed") unless there is a
compiler error ("script compiler ERROR:...")
11) upon script execution error ("script ERROR:..."), provided there is
no compiler error
12) at a variety of points, provided either "set debugScript" or "set
loglevel 5" has been issued
(The distinction between compiler error and execution error is subtle.
With a compiler error, no portion of the script was executed; with an
execution error, the script has been executed up to the point of the
error. Only a portion of the allowed command syntax is checked during
compilation.)
pickCallback
called: when the user clicks an atom
return: atom id, atom number, and xyz coordinates in the form: C6 #6
-0.30683374 -1.6836332 -0.716934
hoverCallback
called: when the user hovers over an atom
return: depends upon the setting of the hover label for the hovered
atom. (See script documentation.)
statusForm
statusText
statusTextarea
called: anytime a message for the document status line is sent
return: status message
note: Not actually function callbacks, these options allow for the
filling of document text and textarea elements with status information
as an alternative to function callbacks.
jmolAppletAddParam
jmolAppletAddParam(appletCode,name,value)
Adds parameter data to an applet definition HTML string previously
created using:
jmolSetDocument(0)
var appletCode = jmolApplet(....)
appletCode = jmolAppletAddParam(appletCode, ....)
for later writing to the web page using
document.write(appletCode)
jmolGetPropertyAsArray
jmolGetPropertyAsArray(sKey,sValue,targetSuffix)
Returns applet information in the form of a JavaScript array, when
applicable, and a JavaScript string when not. See the script
documentation for a full discussion of key options and their return
values. Examples include:
var atoms = jmolGetPropertyAsArray("atomInfo","all")
var atom1 = atoms[0]
var x = atom1.x
var info = atom1.info
jmolGetPropertyAsString
jmolGetPropertyAsString(sKey,sValue,targetSuffix)
Returns data as per jmolGetPropertyAsArray, but always as a JavaScript
string. (Prior to Jmol 11.1, in the case of arrayed data, this string is
in the form of JavaScript Object Notation; starting with Jmol 11.1 the
string is tab/line-delimited for easier reading.)
jmolGetPropertyAsJSON
jmolGetPropertyAsJSON(sKey,sValue,targetSuffix)
Returns data as per jmolGetPropertyAsArray, but always as a JavaScript
string in JavaScript Object Notation. This string can then be surrounded
by parentheses and evaluated to create array content. For example:
var info = jmolGetPropertyAsJSON("filename")
sets the info variable to be:
{"filename": "file:/C:/data/caffeine.xyz"}
Then
var Info = eval("(" + info + ")");
results in a new JavaScript array Info having the element Info.filename
with the value "file:/C:/data/caffeine.xyz"
jmolGetPropertyAsJavaObject
jmolGetPropertyAsJavaObject(sKey,sValue,targetSuffix)
Returns the property as a Java (not JavaScript) object. This function is
for advanced users only and is not generally recommended, as it delivers
a pointer to the Java object itself, not a copy of it. This pointer may
or may not be valid indefinitely and may or may not be properly
garbage-collected by all browsers. Not tested extensively on a variety
of platforms. The principle use of this function is for access to public
Viewer methods that are not generally available via the applet
interface. For example:
var viewer = jmolGetPropertyAsJavaObject("jmolViewer")
var radius = viewer.getRotationRadius();
A list of most of these public methods are listed in
http://svn.sourceforge.net/viewvc/jmol/trunk/Jmol/src/org/jmol/api/JmolViewer.java?view=markup
jmolDecodeJSON
jmolDecodeJSON(sJSON)
Decodes a JavaScript Object Notation string into a JavaScript string
that can be read by humans or executed as JavaScript. For example:
var info = jmolGetPropertyAsJSON("atominfo", "atomno=1")
alert(jmolDecodeJSON(info))
displays:
atominfo=new Array()
atominfo[0]=new Array()
atominfo[0].element="hydrogen"
atominfo[0].visible=true
atominfo[0].model=1
atominfo[0].radius=0.5
atominfo[0].visibilityFlags=13
atominfo[0].clickabilityFlags=12
atominfo[0].bondCount=1
atominfo[0].atomno=1
atominfo[0].elemno=1
atominfo[0].z=0.5733036
atominfo[0].y=-1.1272367
atominfo[0].x=-3.380413
atominfo[0].partialCharge=0
atominfo[0].sym="H"
atominfo[0].colix=-32767
atominfo[0].spacefill=60
atominfo[0].color="ffffff"
atominfo[0].info="H1 #1"
atominfo[0]._ipt=0
atominfo[0].formalCharge=0
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users