Bob,
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. Commenting 
out callbacks 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.

-Rob

Date: Thu, 25 Sep 2008 10:52:35 -0500
From: [EMAIL PROTECTED]
To: jmol-users@lists.sourceforge.net
Subject: Re: [Jmol-users] ff3 vs safari.. again.. load

no kidding! What's firing the loadLigands() function? A button? A callback 
(that could be the problem -- not good to run jmolScript from a callback on 
some platforms, I think).

Try using

setTimeout("loadLigands('....')",100)


in whatever call is doing that. I know the quotes are pain there. You might 
implement it this way:

      function loadLigands(structure, trigger) {
        if (!trigger) {
           setTimeout("loadLigands('"+structure+"',1)",100)

           return
        }
        var load_script = "load " + structure + ";select all; spacefill 20%; 
wireframe 0.35;";
        jmolScript(load_script);
      }

This starts a new thread so that the thread involved in the user clicking can 
complete, and the load can go by a different thread.


But really, that's very odd.

Bob


On Thu, Sep 25, 2008 at 10:32 AM, rob yang <[EMAIL PROTECTED]> wrote:






Hi all,
So here's something new that's confusing me. I am loading a multi-structure 
mol2 file. That's as simple as it gets, right? That's what I thought too till 
safari spoke. In Firefox3, the molecule loads no problem. In safari, it 
doesn't.. *unless* I put in an alert message right before the load command. 
Below is the barebone of my code. It seems like something is out of sync in 
safari that I need to slow it down (alert message) for the script to catch up. 
Help. Thanks.


-Rob

----
<html>
  <head>
    <script src="/submit/jmol-11.6.RC15/Jmol.js"></script>
    <script type="text/javascript">
      function loadLigands(structure) {

          var load_script = "load " + structure + ";select all; spacefill 20%; 
wireframe 0.35;";

         //alert(load_script); // ------UNCOMMENT THIS ALERT MESSAGE TO GET IT 
TO WORK IN SAFARI-----

      
        jmolScript(load_script);
      }
      function messageCallback(app, msg) {
    msg = "" + msg+"";    /* convert callback message into string (recommended 
by other Jmol users) */

      if (msg.match(/ScriptException/)) {alert("=== Jmol SCRIPT ERROR ===\n" + 
msg);}
      else if (msg.match(/java\.security\.AccessControlException/)) {alert("=== 
Java Error ===\nA Java error prevented loading of the structure");}

      else if (msg.indexOf("ERROR")>=0 && msg.indexOf("load >>") >= 0) 
{alert(msg);}
      }
    </script>

</head>
<bod>
<body 
onload="loadLigands('file:///Library/WebServer/Documents/toy/vs_analysis/result0.mol2');">

  
          
        <script type="text/javascript">
          jmolInitialize("/submit/jmol-11.6.RC15/", "JmolAppletSigned.jar");
          jmolSetCallback("messageCallback","messageCallback");

          jmolApplet([600, 450]);
        </script>
        <!-- end jmol -->
        
</body></html>





Get your information fix on your phone. With MSN Mobile you get regular news, 
sports and  finance updates. Try it today!


-------------------------------------------------------------------------

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




-- 
Robert M. Hanson
Professor of Chemistry
St. Olaf College
1520 St. Olaf Ave.
Northfield, MN 55057
http://www.stolaf.edu/people/hansonr

phone: 507-786-3107


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



_________________________________________________________________

-------------------------------------------------------------------------
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