> Just to clarify, I'm working in Java not JavaScript.

Yes, callbacks are by default thought to be attached to a JavaScript 
function, that's why you need yo use the "jmolscript" prefix. After 
that, either you include Jmol commands (and 'script' is one of them) 
or a JmolScript function as bob suggested.


> set hovercallback = "jmolscript:Jmol select
>  _atomHovered; colour atoms red"
> 

Sorry I was not too explanative. This will be it:
 set hovercallback = "jmolscript: select _atomHovered; colour atoms 
red"



> Sadly this doesn't work.
> Any suggestions? And could we have an example added to the 
> interactive script docs please?
> Dave
> 
> 
> On 15 April 2013 01:19, Robert Hanson <hans...@stolaf.edu> wrote:
>     Just define a function and call it from your callback:
>     
> 
>     function myfunc() {
>     -- Jmol script here --
>     
>     
>     }
>     
> 
>     set hoverCallback "jmolscript:myfunc()"
>     
> 
>     The global variable _atomhovered will contain the atom index of the 
>     hovered atom. So you can investigate it, perhaps:
> 
>     function testme() {
>     
>     Var theAtom = {atomindex=_atomHovered}
>     if (theAtom.elemno==6) {hoverLabel="That's a carbon"} else 
>     {hoverLabel = "That's not a carbon"}
>     }
>     
>     set hovercallback "jmolscript:testme()"
> 
> 
>     
> 
>     On Sun, Apr 14, 2013 at 5:21 PM, N David Brown <hubd...@gmail.com> 
>     wrote:
>     I've seen this in the documentation:
> 
>     set hoverCallback "jmolscript:script hover.spt"
> 
>     I'd like my JAR to not have to deploy files like this hover.spt to 
>     the environment.
> 
>     Is there an in-JAR filepath you can specify here?
> 
>     Or an inline script variation?
> 
>     Dave
> 
>     ----------------------------------------------------------------------
>     --------
>     Precog is a next-generation analytics platform capable of advanced
>     analytics on semi-structured data. The platform includes APIs for 
>     building
>     apps and a phenomenal toolset for data science. Developers can use
>     our toolset for easy data analysis & visualization. Get a free 
>     account!
>     http://www2.precog.com/precogplatform/slashdotnewsletter
>     _______________________________________________
>     Jmol-developers mailing list
>     Jmol-developers@lists.sourceforge.net
>     https://lists.sourceforge.net/lists/listinfo/jmol-developers
> 
>     
>     
>     --
>     Robert M. Hanson
>     Larson-Anderson Professor of Chemistry
>     Chair, Chemistry Department
>     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
> 
> 



------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Jmol-developers mailing list
Jmol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to