That sounds like a great idea, Jonathan. You could follow the method I used
for buttons:

// bh 1/2010  -- adds option to run a JavaScript function from any Jmol
control.
//               This is accomplished by passing an array rather than a
script:
//               jmolHref([myfunc,"my param 1", "my param 2"], "testing")
//               function myfunc(jmolControlObject, [myfunc,"my param 1",
"my param 2"], target){...}
//               and allows much more flexibility with responding to
controls

Bob

On Tue, Jul 13, 2010 at 5:05 PM, Jonathan Gutow <[email protected]> wrote:

> Actually it would not be hard to make an extended version of the
> ColorPickerBox that doesn't take a script but a name of a function which
> would generate the scriptstr with $COLOR$ in the appropriate place.  Is that
> what you need?
>
> Jonathan
>
> On Jul 13, 2010, at 12:54 PM, [email protected]:
>
> Piero,
>
> Please include the part where you call the ColorPickerBox.  You are
> supposed to pass the ColorPickerBox the string, which in the formulation you
> provide may not have the necessary space before the color.
>
> I'm unclear on exactly what you are trying to do.  The ColorPickerBox
> substitutes the color the user chooses for $COLOR$ in the script you
> provide.  Another possibility is that you are running up against the fact
> that JmolColorPickerBox is writing html and javascript to your page
> dynamically, but does not have a mechanism for updating the script once the
> box is created.  If that is the problem I will have to think on it a little.
>  We can also consider making a version that passes the color to a function
> of your choosing.  Then you could send a script that is modified on the fly.
>
> Jonathan
> On Jul 13, 2010, at 8:03 AM, [email protected]
> wrote:
>
> Date: Tue, 13 Jul 2010 11:44:57 +0100
>
> From: P.Canepa <[email protected]>
>
> Subject: [Jmol-users] problem setting element colors with
>
> JmolColorPickerBox
>
> To: "[email protected]"
>
> <[email protected]>
>
> Message-ID:
>
> <[email protected]>
>
> Content-Type: text/plain; charset="us-ascii"
>
>
> Dear all,
>
>
> do you know why  JmolColorPickerBox( doesn't work ? The string  scriptColor
> = "' color " + element + " $COLOR$'"; s correctly written.
>
>
>
>
> var scriptColor =  "";
>
> function elementSelected(element){
>
>
>  scriptColor = "' color " + element + " $COLOR$'";
>
>  return scriptColor;
>
> }
>
>
>                          Dr. Jonathan H. Gutow
> Chemistry Department                                [email protected]
> UW-Oshkosh                                          Office: 920-424-1326
> 800 Algoma Boulevard                                FAX:920-424-2042
> Oshkosh, WI 54901
>                 http://www.uwosh.edu/facstaff/gutow
>
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Jmol-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jmol-users
>
>


-- 
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 Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to