Make marvinview applet to create in specified location

User 7b920125ea

08-02-2013 12:57:23

Hi,


I have a problem in a use case wich concern marvinview applet.


I retrieve molecule in sdf format by an ajax call, here no problem. But i want to instantiate an applet with the ajax data to a specific location on my web page.


I use the provided code as :


mview_begin("../../..", 200, 200);
mview_param("mol", mymol_in_a_javascript_var);
mview_end();


It is already working on another (simplified) page, so no problem on the molecule data format, or anything. The problem is to instantiate the applet in the right place, as many applets can exists at the same time.


 


Thank you.

ChemAxon 4fa3cf533c

09-02-2013 17:36:45

Dear Quentin Delettre!


I suggest to use of mview_end_to_string() function which gives you back the html code for the applet, and then enclose it in a div tag or something similar, which you could easily place anywhere you would want to.


Best regards,


Tamas Fazekas-Vigh

User 7b920125ea

11-02-2013 08:36:37

Dear Tamas,


Thanks for the reply. I have another question. Is it possible to change the background of a marvin applet, within javascript code ? I want to change the background on a user click event somewhere on my page.

ChemAxon 5433b8e56b

11-02-2013 11:11:31

Hi Quentin,


You mean the background of the canvas, or the whole application?


For the canvas you can set the background color via the molbg paramter initially, but can not change it runtime from javascript. What is your main aim by setting the color on a user click? Maybe we can offer something wich is doable with the current version, or we can consider you request, and can put it to our plans.


Besides the setting of the canvas color, you can use the setBackground method on the applet API, if you want to set the background of the whole application. This method is inherited from java.awt.Component class, and to be honest we do not know for sure that it will work as expected in the Applet, since we have never tested it, but if you are experienceing problem, and if you need this feature to work correctly, do not hesitate to ask for it, and we will consider to check and fix the issues you are experiencing.


Regards,
Istvan 

User 7b920125ea

11-02-2013 11:19:39

Hi ifajth,


I was talking about the canvas background, and wanted to change it dynamically by javascript. I am embedding marvinview applet inside a table, and the user may by able to select rows (note that the applet creation is dynamic : the user call it by a button and can remove it). I wanted to color the applet accordingly to the row when it is selected.


The best thing would be that marvin for javascript could offer the same services as marvinview, such as rotation in 3d ! It would be nice to avoid using java for this kind of thing now.

ChemAxon 5433b8e56b

11-02-2013 11:50:36

Hi,


I understand your concern about 3D presenting possibility in the Javascript version, and we have this feature in our plans. You can directly contact with the Javascript development team via their forum topic, if you want to emphasise the need, and if you would like to have more detailed information on the roadmap of this development.


In the mean time we will consider to include a method in the Applet API to change the background color dynamically. Since for this I could not offer a workaround, or other  I am filing an issue for this into our issue tracker, and we will prioritize it and can give you an estimation of the release which will include this new method, after our next planning session which will be hold on tuesday next week. I think we can include it in the very near future since it seems not a big deal, but 5.12.0 could not contain it since it is in its beta phase. 


Thank you for your patience in the mean time.


Regards,
Istvan