yes, this sounds like the way to go.

  // / JmolCallbackListener interface ///
  public boolean notifyEnabled(EnumCallback type) {
    switch (type) {
    case HOVER:
      return true;
    }
    return false;
  }

  @SuppressWarnings("incomplete-switch")
  public void notifyCallback(EnumCallback type, Object[] data) {
    String strInfo = (data == null || data[1] == null ? null : data[1]
        .toString());
    switch (type) {
    case HOVER:
....
   }
}



On Mon, Apr 15, 2013 at 4:33 AM, N David Brown <hubd...@gmail.com> wrote:

> That command still doesn't work, Angel.
>
> set hovercallback = "jmolscript: select _atomHovered; colour atoms red"
>
> In other news - I've created a custom JmolCallbackListener which is
> giving me ECHO and PICK events.
>
> Is there a HOVER event or similar I can enable?
>
> This will give me the Java notification I need.
>
> Many thanks,
>
> Dave
>
>
> On 15 April 2013 10:12, N David Brown <hubd...@gmail.com> wrote:
>
>> Ah, thanks Angel.
>>
>> I'll make a note of that for future reference.
>>
>> Since realising I'll need to have a callback in my own Java code I'm now
>> looking at JmolCallbackListener.
>>
>> Cheers,
>>
>> Dave
>>
>>
>> On 15 April 2013 10:09, Angel Herráez <angel.herr...@uah.es> wrote:
>>
>>> > 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
>
>


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