MarvinSketch Example - Loading a molecule in visualization mode, using magnification
This molecule is loaded by the applet from a file named "caffeine.mol" which resides in the directory "../../../mols-2d" (relative to the URL of this document).
The applet above was started in visualization (view only) mode (i.e., the editing buttons cannot be seen). You can get into editing mode by selecting View > Toolbar in the applet. We have also used the autoscale parameter of the applet to fit the molecule into the window.
Note that the initial molecule and the magnification can also be set runtime, with the<script type="text/javascript" SRC="../../../marvin.js"></script> <script type="text/javascript"> <!--msketch_begin("../../..", 540, 480); msketch_param("mol", "../../../mols-2d/caffeine.mol"); msketch_param("viewonly", "true"); msketch_param("autoscale", "true"); msketch_end();//--> </script>
setMol
and the setScale
public methods.
Usually this simple method of loading a molecule works well enough. However, sometimes it is better if the applet does not make any network connection, for instance if the user's computer is off-line, and the page with the applet comes from the browser's cache. The next example shows the solution for this situation.
Do you have a question? Would you like to learn more? Please browse among the related topics on our support forum or search the website. If you want to suggest modifications or improvements to our documentation email our support directly!


