On 25 Sep 2008 at 11:09, rob yang wrote:
> That works, although I needed to sleep for 500 instead of 100. the 
> loadLigands() function is fired 
> up by <body onload="loadLigands();">. I am wondering if it's a case of safari 
> browser does 
> something different in executing the <body onload=...> functions. It almost 
> seems to me like 
> loadLigands() was executed before the applet finished initializing. 

My experience is that yes, often the page finishes loading before the applet 
fully loads, so 
that sounds likely to me as the cause of the problem. And that's in Windows 
(mainly Firefox, 
but probably IE too) while I don't know much about threading and am certainly 
doing nothing 
about it on purpose

The safe way is not to do the script upon page load, but to include it the 
jmolApplet() call 
itself. That way, the processes are consecutive. (Not sure it this solution is 
applicable to 
your setup, see below.)

> does not help. Who knows what's going on with all that threading business. 
> But in any case, 
> sleeping is a quick fix to it. Thanks.

The problem there is that the needed amount of sleeping time may depend on the 
connection: not the same in local disk and local server tests than for a user 
getting the page 
and the applet across the ocean.


It could be like this:

<body>          
        <script type="text/javascript">
          jmolInitialize("/submit/jmol-11.6.RC15/", "JmolAppletSigned.jar");
          jmolSetCallback("messageCallback","messageCallback");
          jmolApplet([600, 450],  'load 
"file:///Library/WebServer/Documents/toy/vs_analysis/result0.mol2"; select all; 
spacefill 
20%; wireframe 0.35; ' );
        </script>


or, if you need to keep it dynamic by using the function:
<body>          
        <script type="text/javascript">
          jmolInitialize("/submit/jmol-11.6.RC15/", "JmolAppletSigned.jar");
          jmolSetCallback("messageCallback","messageCallback");
          jmolApplet([600, 450],  
loadLigands('file:///Library/WebServer/Documents/toy/vs_analysis/result0.mol2') 
);
        </script>

with
  function loadLigands(structure) {
        var load_script = "load " + structure + ";select all; spacefill 20%; 
wireframe 0.35;";
        return load_script;
      }

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to