Quick mind Bob
my functions are. Then what's wrong ?
Thanks, Piero
function loadModels(selectbox){
removeAllModels()
var Info = jmolGetPropertyAsArray("auxiliaryInfo.models")
if(!Info){
alert("No models available")
return
}
for(var i=0; i< Info.length; i++)
addOption(document.modelsVib.models, i + " " + Info[i].name, i + 2);
}
function myMessageCallback(a,m) {
m = "" + m
// important to do this to change from Java string to JavaScript string
if (m.indexOf("DONE") == 0) loadModels()
}
function onClickLoadStruc() {
jmolScriptWait("load ?; background white; set messageCallback
'myMessageCallback';message DONE");
}
--
Pieremanuele Canepa
Room 104
Functional Material Group
School of Physical Sciences, Ingram Building,
University of Kent, Canterbury, Kent,
CT2 7NH
United Kingdom
e-mail: [email protected]
mobile: +44 (0) 7772-9756456
-----------------------------------------------------------
________________________________
From: P.Canepa [[email protected]]
Sent: Thursday, April 15, 2010 4:42 PM
To: [email protected]
Subject: Re: [Jmol-users] (no subject)
Are you sure because nothing seems to change!
--
Pieremanuele Canepa
Room 104
Functional Material Group
School of Physical Sciences, Ingram Building,
University of Kent, Canterbury, Kent,
CT2 7NH
United Kingdom
e-mail: [email protected]
mobile: +44 (0) 7772-9756456
-----------------------------------------------------------
________________________________
From: Robert Hanson [[email protected]]
Sent: Thursday, April 15, 2010 4:30 PM
To: [email protected]
Subject: Re: [Jmol-users] (no subject)
Ah, ok. I remember. You are getting an access violation because the thread that
runs the load command cannot also run the JavaScript command.
Problem: I want to load a file using the dialog in the signed applet and then
after that run some JavaScript.
Solution: You must use the message callback mechanism to let your page know
that the loading is done, and from THAT function, run your JavaScript:
function loadModels(){
removeAllModels()
var Info = jmolGetPropertyAsArray("auxiliaryInfo.models")
.. etc...
}
function myMessageCallback(a,m) {
m = "" + m
// important to do this to change from Java string to JavaScript string
if (m.indexOf("DONE") == 0) loadModels()
}
function onClickLoadStruc() {
jmolScript("load ?; background white;set messageCallback
'myMessageCallback';message DONE")
}
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
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users