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]>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("I'm in myMessageCallback: " + one);
> console.info("I'm in myMessageCallback: " + two);
> }
>
> function getJSmolInfo(state) { // called from another part of my
> code.
> try {
> 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("getJSmolInfo exit");
> return Jmol.getPropertyAsArray(jmolObject, "orientationInfo");
> } catch (err) {
> console.info("ERR getJSmolOrientationInfo xxx");
> console.info(err);
> }
> return null;
> }
>
> function script(script) {
> try {
> jmolObject._script(script);
> } catch (err) {
> console.info("ERR scriptWait");
> 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]
> 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