Hello Jay,

This may go without saying, but I'll say it just in case you're not 
sure. Whatever  color picking tool (interface) you use, have the user 
selected color put into a global JavaScript variable. Alternatively, 
create the global variable in Jmol script itself. If this variable is 
called sColor, then Bob's callback script then becomes:

In JavaScript  --> var scr = "select within(group, selected);color " +  
sColor + ";"

In Jmol script directly --> select within(group, selected);color @sColor;

In either case, here are example sColor assignments that would occur at 
the color selection tool:

sColor = "[xFF00FF]" or sColor = "magenta"

If you use the Jmol script approach, the global can be defined in the 
applet load script - e.g. var sColor = "". In the JavaScript approach, 
the global is defined in a page load script declaration section.

Jonathan may already have global hooks set in the color widget. I'm not 
sure. I'm still a bit confused about when a Jmol variable goes global. I 
know from experience it goes global if declared in the load script as 
suggested above. I'm not sure if it can be Jmol globalized in a widget. 
It can, of course, be JavaScript globalized by simply keeping its 
original declaration outside of any function.

Otis

On 6/10/2010 5:15 PM, Robert Hanson wrote:
> We have a nice color widget now, and it could be adapted.... Jonathan, 
> does the color widget allow you to tie it to any script command?
>
> The basic idea is
>
> 1) set a pick callback so you know what residue(s) were clicked. -- or 
> I guess just use set picking select.
> 2) in response to a color pick -- say it's "[xFF00FF]" you would 
> construct the script
>
> var scr = "select within(group, selected);color [xFF00FF]"
>
> and send that to Jmol using
>
> jmolScript(scr)
>
>
Otis Rothenberger
chemagic.com




------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to