Hello,
I need to alter the format of the hover label.  I have a message that is more than one line and will, perhaps, have a weblink inside.  I searched the forums, and I found the following line:
set hoverLabel "label format"

What are the options and syntax for the label format?
Thanks!
Aya


On Fri, Dec 25, 2009 at 9:32 PM, Robert Hanson <hansonr@stolaf.edu> wrote:
Well, if you want to get information back from Jmol, the easiest way is using jmolEvaluate:

<script type="text/javascript">
var x = jmolEvaluate('script("for(var i = 0; i < 10;i++){print i}")')
</script>

note the careful use of single and double quotes. You can avoid some of that complexity by first defining the script:

var script = 'script("for(var i = 0; i < 10;i++){print i}")'
var x = jmolEvaluate(script)

so for my script it would be:

var script =  'script(" for (var i = 0; i < site_list.length; i++) {script inline @{\'select atomIndex = _atomhovered and \' + site_list[i]};if ({selected}) {print site_list[i] }}")'
var x = jmolEvaluate(script)

(I think)

Or you could first get all the information with

var info = jmolEvaluate('getProperty("stateInfo")')

and then work from there.

Bob




On Fri, Dec 25, 2009 at 1:08 PM, Aya <aeid@iit.edu> wrote:
Hello,
I'm not understanding a fundamental part, and I think this is why I am having such troubles.


> Decoding that, I see:
>
> if ({atomIndex=_atomHovered}&{site1}) {
>   hover "default1"; select site1; halos 25%;color halos red; select all;
> } else if ({atomIndex=_atomHovered}&!{site1}) {
>   hover %U; select site1; halos off
> }

So this is a clip of what I have in the head of my page:

<script language="javascript">
function customhover(){

      if(myListL.options[1].selected == true){ jmolScript(
                        'if ({atomIndex=_atomHovered}&{site1}); ' +
                                'hover "default1"; select site1; halos 25%;color halos red; select all;' +
                        'else if ({atomIndex=_atomHovered}&!{site1}); ' +
                                'hover %U; select site1; halos off;' +
                        'end if; ',"LeftApplet")
        }
}
</script>   


And here in the end of the body:

<script type="text/javascript">
        jmolApplet([410,480],'load jmol/models/practice.pdb;set hoverCallback "customhover"; define site1 atomno=1; define site2 atomno=2;','LeftApplet')
 </script>


How do I run the script as you have suggested?
As for the last part ...hm.  I know "@" allows you to define a variable and I see you've made an array of sites...
Thank you!
Aya









On Fri, Dec 25, 2009 at 3:54 PM, Robert Hanson <hansonr@stolaf.edu> wrote:
>
>
> On Fri, Dec 25, 2009 at 4:56 AM, Aya <aeid@iit.edu> wrote:
>>
>> Hello,
>> I am making a webpage in which the molecule has some 10 sites (defined
>> as site1, site2 ... upon loading the applet ), and the user can select
>> which site(s) he wants to view (the halos get turned on and an
>> isosurface gets generated).  When the mouse hovers over a site that
>> has been selected, I want a specific hover message to appear.
>> Additionally, some atoms may belong to more than one site.  In this
>> case, the hover message must append additional information.
>>
>> Here is one attempt at this.  This code is within my custom hover
>> function called by the set hovercallback:
>>              if(myListL.options[1].selected == true){jmolScript(
>>                        'if ({atomIndex=_atomHovered}&{site1}); ' +
>>                                'hover "default1"; select site1; halos
>> 25%;color halos red; select all;' +
>>                        'else if ({atomIndex=_atomHovered}&!{site1}); ' +
>>                                'hover %U; select site1; halos off;' +
>>                        'end if; ',"Leftapplet")}
>>
>
> Decoding that, I see:
>
> if ({atomIndex=_atomHovered}&{site1}) {
>   hover "default1"; select site1; halos 25%;color halos red; select all;
> } else if ({atomIndex=_atomHovered}&!{site1}) {
>   hover %U; select site1; halos off
> }
>
>
>> This says that if the first site is selected and the first site is
>> being hovered, there is the custom message, if it's anything But
>> site1, then hover is normal.  This does not solve the problem! For
>> several reasons.  What I need to do is include a some kind of
>> jmolScript that will Return a boolean if the atom hovered is part of
>> site1, site2.. (as in, a jmol  script that will evaluate
>> ({atomIndex=_atomHovered}&{site1}) )  OR some kind of jmol script that
>> will return the sites that the atom hovered belongs to  OR maybe a way
>> to insert variables into the jmolScript that have been defined in the
>> previous javascript. OR any other suggestion you may have!
>>
>
>  for (var i = 0; i < site_list.length; i++) {script inline @{"select " +
> site_list[i]};print {selected}}
>
> This gives all the atoms in each site. So if you could use:
>
>  for (var i = 0; i < site_list.length; i++) {
>   script inline @{"select atomIndex = _atomhovered and " + site_list[i]}
>   if ({selected}) {
>     print site_list[i]
>   }
> }
>
>
> That would at least get you the list.
>
> A slicker option would be to read the state once after file loading and then
> parse it for the information you want:
>
>   @site_1 ({299:314 334:384 719:734 754:804 1139:1154 1174:1224 1559:1574
> 1594:1644 1979:1994 2014:2064 2399:2414 2434:2484 2819:2834 2854:2904
> 3239:3254 3274:3324 3659:3674 3694:3744 4079:4094 4114:4164 4499:4514
> 4534:4584 4919:4934 4954:5004 5339:5354 5374:5424 5759:5774 5794:5844
> 6179:6194 6214:6264});
>   @site_ac1 ({19:34 439:454 859:874 1279:1294 1699:1714 2119:2134 2539:2554
> 2959:2974 3379:3394 3799:3814 4219:4234 4639:4654 5059:5074 5479:5494
> 5899:5914});
>   @site_ac2 ({0:18 35:53 420:438 455:473 840:858 875:893 1260:1278 1295:1313
> 1680:1698 1715:1733 2100:2118 2135:2153 2520:2538 2555:2573 2940:2958
> 2975:2993 3360:3378 3395:3413 3780:3798 3815:3833 4200:4218 4235:4253
> 4620:4638 4655:4673 5040:5058 5075:5093 5460:5478 5495:5513 5880:5898
> 5915:5933});
> ...
>   site_ac1 = ["[IDS]2:A"];
>   site_ac2 = ["[SGN]1:A", "[SGN]3:A"];
>   site_ac3 = ["[IDS]2:A", "[IDS]4:A", "[SGN]5:A", "[IDS]6:A"];
> ...
>   site_list = ["site_BC9", "site_BC8", "site_BC7", "site_BC6", "site_BC5",
> "site_BC4", "site_BC3", "site_BC2", "site_BC1", "site_AC9", "site_AC8",
> "site_AC7", "site_AC6", "site_AC5", "site_AC4", "site_AC3", "site_AC2",
> "site_CC6", "site_AC1", "site_CC5", "site_CC4", "site_CC3", "site_CC2",
> "site_CC1"];
>  
>
> Bob
>
>
>> Thank you kindly for your help!
>> Aya
>>
>>
>> ------------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Verizon Developer Community
>> Take advantage of Verizon's best-in-class app development support
>> A streamlined, 14 day to market process makes app distribution fast and
>> easy
>> Join now and get one step closer to millions of Verizon customers
>> http://p.sf.net/sfu/verizon-dev2dev
>> _______________________________________________
>> Jmol-developers mailing list
>> Jmol-developers@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/jmol-developers
>
>
>
> --
> 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 Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev
> _______________________________________________
> Jmol-developers mailing list
> Jmol-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jmol-developers
>
>


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Jmol-developers mailing list
Jmol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-developers




--
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 Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Jmol-developers mailing list
Jmol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-developers