Thanks, Bob! I’ll download the latest build this weekend.
My app calls several initialization functions and init_jsmol is one of them. I
initialize my UI (view), the state of my app (controller and model), then I
initialize jsmol. I want to use the callbacks to populate the model. The
model.is.is<http://model.is.is>_jsmol is the id of the div where I want Jmol to
render the image. It certainly seems reasonable in hindsight to look at an
example called images.htm. Wish I’d thought of that.
—Chuck
On Feb 8, 2014, at 1:40 PM, Robert Hanson
<[email protected]<mailto:[email protected]>> wrote:
Jmol.setXHTML = function(id)
is almost never used and hasn't been tested much. This is an HTML5 app, not
XHTML.
What is calling init_jsmol(state), and when?
With jQuery now, it's much easier. Check some of the examples in jsmol.zip.
http://chemapps.stolaf.edu/jmol/jsmol/images.htm
is a good example that uses jQuery for the applet construction and also uses
callbacks.
On Fri, Feb 7, 2014 at 1:38 PM, Charles Harrison Shubert
<[email protected]<mailto:[email protected]>> wrote:
Hi,
I'm clearly not reading the documentation correctly and I'm missing something.
I want to use the JSmol callback functionality. What am I doing wrong?
Thanks,
--Chuck
My javascript:
function init_jsmol(state) {
// … other initialization
Jmol.setXHTML(model.ids.id_jsmol);
var Info = {};
Info.script = session.modelControl.getActiveScript(state);
Info.j2sPath = model.jsmol.j2sPath;
Info.disableInitialConsole = true;
Info.disableJ2SLoadMonitor = true;
jmolObject = Jmol.getApplet(model.ids.id_jsmol, Info);
// … other initialization
}
function myMessageCallback(one, two) {
console.info<http://console.info/>("I'm in myMessageCallback: " + one);
console.info<http://console.info/>("I'm in myMessageCallback: " + two);
}
function getJSmolInfo(state) { // called from another part of my code.
try {
console.info<http://console.info/>("getJSmolInfo entry");
script(";set messageCallback 'myMessageCallback';");
script(";define chucksel '[ALA]1:A.O or [ALA]1:A.C'; select
chucksel; color atoms pink;");
script("message 'hi ho';");
console.info<http://console.info/>("getJSmolInfo exit");
return Jmol.getPropertyAsArray(jmolObject, "orientationInfo");
} catch (err) {
console.info<http://console.info/>("ERR getJSmolOrientationInfo
xxx");
console.info<http://console.info/>(err);
}
return null;
}
function script(script) {
try {
jmolObject._script(script);
} catch (err) {
console.info<http://console.info/>("ERR scriptWait");
console.info<http://console.info/>(err);
}
}
What I see: the Alanine that I loaded has the A.O and A.C colored pink. I
also see the "orientationInfo" when I look at the return from getJSmolInfo.
The "state" argument to getJSmolInfo is for later use.
What I didn't see: "hi ho" in the console or any evidence that
myMessageCallback is called.
Chrome Console:
getJSmolInfo entry
jsmolControl.js:89<http://localhost:8002/StarBiochem/sb_controller/jsmolControl.js>
getJSmolInfo exit
jsmolControl.js:93<http://localhost:8002/StarBiochem/sb_controller/jsmolControl.js>
exec _jsmol loadClazz null -- OK VM592:250
exec _jsmol start applet null -- OK VM592:250
event.returnValue is deprecated. Please use the standard event.preventDefault()
instead. VM592:110
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Jmol-users mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/jmol-users
--
Robert M. Hanson
Larson-Anderson Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr
If nature does not answer first what we want,
it is better to take what answer we get.
-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users