A few more, while we are at it...
id="AnimContrl"
not showing suffix 0,1,2,etc.
JmolColorPickerBox(scriptStr, [0,0,0], 'backbox1', '1')
is the only one that puts ' ' around the number. Probably should remove
those.
OK, I think for sure looking at the HTML code this produces, that we DO want
appletID for all those because really they are _jmol-type functions, not
something to suggest users implement. There's too much necessary stuff
around them. Perhaps a user function could be created that writes all of
this:
<div><table><tbody><tr><td style="min-width:70px;">background color:</td><td
style="min-width:70px;"><script type = 'text/javascript'>var scriptStr =
'color background $COLOR$;';JmolColorPickerBox(scriptStr, [0,0,0],
'backbox0', '0');</script></td></tr></tbody></table></div>
And then that might allow for the appletID to be gotten from jmolSetTarget()
or the most recent applet written.
By the way, why are we creating the global variable "scriptStr" here instead
of just executing JmolColorPickerBox with that parameter? I'm trying to get
us in the mode of not generating unnecessary global variables that might
interfere with other JavaScript. You know that's a huge pain when that
happens, especially if it is code created by another application, like this
is.
I guess I'd suggest the following in Widgets.java:
return "<table><tbody><tr><td style=\"min-width:70px;\">"
+ GT._("background color:")
+ "</td><td style=\"min-width:70px;\"><script type =
'text/javascript'>"
+ "var scriptStr = 'color background $COLOR$;';"
+ "JmolColorPickerBox(scriptStr, ["
+ (int)ptRGB.x + "," + (int)ptRGB.y + "," + (int)ptRGB.z
+ "], 'backbox"
+ appletID + "', '" + appletID + "');"
+ "</script></td></tr></tbody></table>";
look like this:
return "<script type =
'text/javascript'>jmolBackgroundColorPickerBox();</script>";
Simple as that. And then have jmolBackgroundColorPickerBox() create all the
HTML stuff necessary. (Maybe a default there.)
That to me would be more readable in the HTML and also more similar to what
I see in Jmol -- a bit of code for each checkbox that I create.
I think the idea I'm promoting is to have the Jmol application just send the
essentials -- "we need a box here of this sort" -- to the page and let the
JavaScript there do all the details. This makes sense to me because it then
allows more flexibility by the user (who can change the function or
parameters of jmolBackgroundColorPickerBox if desired at the JavaScript
level) and by developers (who then don't need to go into the Java to fix the
JavaScript).
I'll also suggest that there be one JmolWidgets.js that has all the
necessary code in it for all the widgets. The tiny snippets of code in
JmolSpin.js, for example, is just getting too fine-grained. As long as the
files are small, why not just get them all in Widgets.js. I probably
suggested this breaking them out, but....
Finally, I'd like to see these functions allowing the same sort of
flexibility that the jmolButton() and jmolRadio() functions have -- in that
they return code instead of writing it if jmolSetDocument(0) has been
issued.
Consider all this just my 2 cents. Really I defer to Jonathan and Angel on
this.
Bob
On Wed, Jul 7, 2010 at 4:09 PM, Robert Hanson <hans...@stolaf.edu> wrote:
> I get a null pointer exception immediately when I open the Pop-In Jmol page
> and click a checkbox.
>
> --
> 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
>
--
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-developers mailing list
Jmol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-developers