This doesn't even work:
set hoverCallback "jmolscript:print 'Hello'"
I must be doing something fundamentally wrong.
Is there a difference in hover detection when running the Viewer embedded
in a Java app?
Dave
On 15 April 2013 12:12, N David Brown <hubd...@gmail.com> wrote:
Sorry that was old code, I meant to say:
>
> $ function foo() { print _atomHovered }
> $ set hoverCallback "jmolscript:foo()"
>
> This is based on what Bob wrote.
>
> Dave
>
>
> On 15 April 2013 11:23, N David Brown <hubd...@gmail.com> wrote:
>
>> It seems I must generate and capture my own output to detect in Java when
>> a hover event occurs.
>>
>> Could someone please explain why the following doesn't work to enable fooas
>> a hover callback function?
>>
>> $ function foo (atomId) { print atomId }
>> $ foo("H332")
>> H332
>> $ set hovercallback "foo"
>> hovercallback = "foo"
>>
>> Mouse-over of on-screen atoms makes no printout occur.
>>
>> Dave
>>
>>
>> On 15 April 2013 10:33, 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