Intermittent MarvinSketch Setmol problem

User 9b0b2c1b48

24-11-2012 15:35:04

I have a web page (php, html and javascript) that utlizes MarvinSketch.  Occasionally it does not load a structure.  Here is how it proceeds.


I use some php to randomly generate a smiles string that writes it to an html textarea.


I then have the code that loads the marvinsketch applet.


Then I use javascript onload event at end of my script to call importMol which does setmol.


<script LANGUAGE="JavaScript1.1">
window.onload = importMol;
</script>


Is this not the correct way to do this?  I've also tried writing the smiles string to msketch_param("mol","CCC"), but could never get this to work.  Does setting the structure via the applet parameter only support mol files or something?

ChemAxon f052bdfe3c

05-12-2012 17:29:24

Hi,


You can see from this example how you can add a listener into the applet: http://www.chemaxon.com/marvin/examples/applets/sketch/chemicalterms2.html


OR


you can set a molecule using the  parameter "mol"


http://www.chemaxon.com/marvin/examples/applets/sketch/hydrogens.html


Best Regards,


Efi

ChemAxon 12eab24e0a

06-12-2012 08:47:12

Hi,


Answer for the first question: When the window.onload is invoked, the applet has not been initialized yet. When the browser loads the document with an applet, the browser just invokes the Java plugin to start the applet. Since the plugin is responsible for the applet, the browser has no information when applet initialization is finished. That's why we've introduced the "molLoaderFinished" applet parameter. When this parameter is specified, the applet will notify the given Javascript function when its initialization is finished.


Please use this parameter if you would like to perform any action immediately as the applet is loaded!


Second: I admit specifying the initial structure for the applet with mol applet parameter is less complicated, but it seems it does not accept smiles in all cases. If you specify structure as mol or mrv source, the parameter works always fine. We will check this smiles import issue with mol parameter. I will get back to you as soon as we have any answer on this topic.


Thanks,


Eva

User 9b0b2c1b48

04-03-2013 19:02:35

 


Ok I've been struggling with this for quite sometime without a solution.  molLoaderFinished never get fired since my structure never loads.  Can you explain how I can use this to assure that my molecule gets loaded?













ehollo wrote:

Hi,


Answer for the first question: When the window.onload is invoked, the applet has not been initialized yet. When the browser loads the document with an applet, the browser just invokes the Java plugin to start the applet. Since the plugin is responsible for the applet, the browser has no information when applet initialization is finished. That's why we've introduced the "molLoaderFinished" applet parameter. When this parameter is specified, the applet will notify the given Javascript function when its initialization is finished.


Please use this parameter if you would like to perform any action immediately as the applet is loaded!


Second: I admit specifying the initial structure for the applet with mol applet parameter is less complicated, but it seems it does not accept smiles in all cases. If you specify structure as mol or mrv source, the parameter works always fine. We will check this smiles import issue with mol parameter. I will get back to you as soon as we have any answer on this topic.


Thanks,


Eva


ChemAxon 2c555f5717

08-03-2013 10:05:55

Hi!


   We have held a webinar about Marvin Sketch Applet, wher we have a short presentation to communicate from javascript to Marvin.


   Now I attach the corresponding html file, for other details, please watch the video (JavaScript communication is 31:45 -- 34:45). (I have modofied the source to start the applet from our server.)


   The most important things:



   Did you use this function? 


   I hope I could help.


Best regards:
Balázs