MarvinSketch and hidden DIVs

User 276402c609

29-07-2007 13:30:38

The MarvinSketch is destroyed when the DIV (container for applet) via JavaScript is made hidden.





The console shows:


basic: Destroying applet ...


basic: Disposing applet ...


basic: Quiting applet ...





Is there a way to avoid from unloading?





If not, is there and JavaScript event which can be used to detect when applet has finished loading because after the applet loading I must load structure from hidden text field.

User f359e526a1

31-07-2007 09:48:18

Hello, there are similar topics where we addressed something like this:





http://www.chemaxon.com/forum/ftopic2179.html


http://www.chemaxon.com/forum/ftopic1073.html


http://www.chemaxon.com/forum/ftopic1079.html





Are these helpful for you?

ChemAxon 9c0afc9aaf

31-07-2007 13:44:29

Hi,





The applet loading / unloading is controlled by the browser, we have no influence on that.





There is an applet parameter that instructs Marvin to call a JavaScript when the molecule has been loaded at startup or via a JavaScript call.


The syntax looks something like this to call the doSomething() JavaScript function:





Code:



msketch_mayscript=true;


msketch_param("molLoaderFinishedEvent", "js:doSomething()");






Please note that you have to enable the mayscript option for this.





You can find the description of this parameter here:


http://www.chemaxon.com/marvin/doc/dev/sketchman.html





Please note that mayscript calls may not work 100% reliably on some systems.





An other alternative is to simply specify the molecule to load via an applet parameter.


This example specifies a benzene as smiles:


Code:
msketch_param("mol","c1ccccc1")






Of course this latter method will always load the same structure until the page source has changed.





Best regards,





Szilard