Thanks for the suggestion!  I tried several versions of your suggestion.  
Adding a readyFunction to Info worked (where Info.readyFunction points to 
function rather than just the function name worked, but I couldn't make 
messaagecallback work.  I tried pointing Info.messagecallback to both the 
function and the function name and JSmol didn't seem to want to call it.

So, I'm inclined to believe that:

- I'm not loading some piece of JSmol that needs to be loaded, or
- I'm not spelling something correctly, or
- i'm not including something that turns on the message callback behavior.

I suppose that it's possible that there is a bug in JSmol, but that seems 
unlikely.  I replaced the JSmol.min.js with JSmol.full.js and I guess the next 
step is to investigate what the message script command doesn't like about what 
I'm asking it to do.

If you have any suggestions on a debugging technique for isolating this issue 
to a particular section of code, I'd be most appreciative. 

thanks,

--Chuck

On Feb 7, 2014, at 4:01 PM, Rolf Huehne <[email protected]>
 wrote:

> Am 07.02.2014 20:38, schrieb Charles Harrison Shubert:
>> 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';");
>> 
> I never tried to set the message callback by using Jmol Script. What 
> works for me (e.g.: 
> http://jenalib.fli-leibniz.de/cgi-bin/3d_mapping-rh.pl?CODE=1deh&APPLET=html5)
>  
> is setting it in the 'Info' object like this:
> 
> -------------------------------------------------------
>        Info = {
>               use: "JAVA HTML5",
>               width: "600",
>               height: "600",
>               debug: false,
>               color: "black",
>                 j2sPath: 
> "http://jenalib.fli-leibniz.de/ImgLibPDB/jmol/jmol-14.0.5/jsmol/j2s";,
>                 jarPath: "/ImgLibPDB/jmol/jmol-14.0.5/jsmol/java",
>                 jarFile: "JmolAppletSigned.jar",
>                 isSigned: "true",
>                 disableJ2SLoadMonitor: true,
>                 disableInitialConsole: true,
>               addSelectionOptions: false,
>               serverURL: "/ImgLibPDB/jmol/jmol-14.0.5/jsmol/php/jsmol.php",
>               script: "",
>                 messagecallback: "_jmolMessageCallback",
>                 allowjavascript: true
>                };
> 
>        function _jmolMessageCallback(app,msg) {      /* jmol message 
> callback, reverse logging into textarea */
>           msg = "" + msg;    /* convert callback message into string 
> (recommended by other Jmol users) */
>           log_monitor.unshift(msg);
>           if (document.getElementById("jmol_monitor").value.length > 
> 8000) {
>             log_monitor.pop();
>           }
>           document.getElementById("jmol_monitor").value = 
> log_monitor.join("\n");
> 
>           if (msg.match(/([\d,]+) atoms selected/)) {   /*  */
>             var selection_count_tag = 
> document.getElementById("selection_count");
> 
> selection_count_tag.replaceChild(document.createTextNode(RegExp.$1), 
> selection_count_tag.childNodes[0]);
>             document.getElementById("selection_count").innerHtml=RegExp.$1;
>           }
>         }
> -------------------------------------------------------
> 
> So it should work if you add this to your 'Info' initialization:
> 
>   Info.messagecallback = "myMessageCallback";
> 
> Regards,
> Rolf
> -- 
> 
> Rolf Huehne
> Postdoc
> 
> Leibniz Institute for Age Research - Fritz Lipmann Institute (FLI)
> Beutenbergstrasse 11
> 07745 Jena, Germany
> 
> Phone:   +49 3641 65 6205
> Fax:     +49 3641 65 6210
> E-Mail:  [email protected]
> Website: http://www.fli-leibniz.de
> 
>           Scientific Director: Prof. Dr. K. Lenhard Rudolph
>        Head of Administration: Dr. Daniele Barthel
> Chairman of Board of Trustees: Dennys Klein
> 
> VAT No: DE 153 925 464
> Register of Associations: No. 296, Amtsgericht Jena
> Tax Number: 162/141/08228
> 
> 
> ------------------------------------------------------------------------------
> 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

Reply via email to