at 4.50p EDT on 2004 February 26 Thursday timothy driscoll said:

> greetings,
> 
> after some fiddling, I realized that Jmol's pickCallback returns the
> atom data as an Object, not a String.  I can't seem to cast it into a
> String using javascript, which means I can't do grep, split, slice,
> etc.  any help?
> 
> (I've tried toString() but it does not work.)
> 

we have decided this is an issue with Safari's implementation of LiveConnect,
and apparently limited to strings (i.e., not numbers).  it is not a problem
with any other browsers that I have tested, including IE6 or N7 for windows,
or Mozilla on Linux (Miguel).


fortunately the work-around, thanks to Miguel, is straightforward and fully
compatible: 

when your javascript function receives parameters from your Jmol callback
(pick or message), immediately cast them to javascript strings like this:

function jmolPickCallback(id,atomstring,atomid) 
{
   var myid = "" + id;
   var mystring =  "" + atomstring;
   
   // if you plan to use the atomid as a string, too:
   // var myatomid = "" + atomid;
   
   alert(myid " + says " + mystring);
}


the toString() method does not work, even though that is what one would
normally use here.


cheers!

:tim

-- 
timothy driscoll
molvisions - molecular graphics & visualization
<http://www.molvisions.com/>
usa:north carolina:wake forest


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click
_______________________________________________
Jmol-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to