MarvinSketch Example - Student Examination
|
This example shows how MarvinSketch can be used in online examinations in different subjects. This examination example tests the knowledge of students related to lone pairs and radical electrons. Task: Use the two lowermost multifunctional buttons of the toolbar on the left to explicitely define the lone pairs and radical electrons on atoms. Note that the MarvinSketch applet was configured to better suit the task,
for example the Lewis-structure representation is always visible.
|
Technical background
In this example the MarvinSketch applet is customized with the help of parameters. The following changes were made:
- The main menubar is disabled.
- The contextual menu of atoms is disabled.
- The toolbar on the left hand side contains 2 multifunctional buttons for setting lone-pair electrons and radical electrons.
- The bottom template toolbar contains only the "Rings" and a custom "Generic" template groups. The function to modify the visible template groups on-the-fly is disabled.
- The Ctrl-O shortcut is disabled to prevent opening structure files.
- Typing abbreviated groups with the keyboard is disabled.
- The visibility of implicit hydrogen atoms is switched off.
- The automatic calculation of lone-pair electrons is switched off, and the number of lone pairs is set to 0 at each atom as default.
- The automatic calculation and display of valence errors is switched off.
- The C label is always visible on Carbon atoms.
The code of the customized applet is as follows:
<script type="text/javascript" SRC="../../../../marvin.js"></script> <script type="text/javascript"><!-- msketch_name = "MSketch"; msketch_begin("../../../..", 490, 420); msketch_param("menuconfig", "/examples/applets/sketch/studentexam/menuconfig.xml"); msketch_param("lonePairsAutoCalc", "false"); msketch_param("lonePairsVisible", "true"); msketch_param("sketchCarbonVisibility", "on"); msketch_param("implicitH", "off"); msketch_param("valenceErrorVisible", "false"); msketch_param("abbrevgroupsAllowed", "false"); msketch_param("shortcuts", "/examples/applets/sketch/studentexam/shortcuts.xml"); msketch_param("ttmpls0", "*Generic*/examples/applets/sketch/studentexam/generic.csmol"); msketch_param("ttmpls1", "*Rings*chemaxon/marvin/templates/rings.t"); msketch_param("templateToolbarCustomizable", "false"); msketch_end();//--> </script>
The menu configuration file: menuconfig.xml
The shortcut configuration file: shortcuts.xml
Custom "Generic" template group file: generic.csmol
The 'Submit Answer' button generates the ChemAxon Extended Smiles. The u option
was used to generate unique smiles.
<script type="text/javascript" SRC="../../../../marvin.js"></script>
<script type="text/javascript">
function exportMol(format) {
if(document.MSketch != null) {
var s = document.MSketch.getMol(format);
document.MolForm.MolTxt.value = s;
} else {
alert("Cannot import molecule:\n"+
"no JavaScript to Java communication"+
"in your browser.\n");
}
} </script>
... // creating HTML form
<input TYPE=BUTTON VALUE="Submit Answer"
onClick="exportMol('cxsmiles:u')">
... // creating HTML form
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!


