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

Reply via email to