MarvinView Example - Listening for events in applets

In this example the java.beans.PropertyChange and java.awt.event.MouseEvent events that are fired by the MarvinView applet are logged in the text areas below the applet.

Property Change Events: Mouse Events:

The 2 main parameters are listenpropertychange and listenmouseevent. They trigger calls to the propertyChange and mouseEvent JavaScript methods.

<script type="text/javascript" SRC="../../../marvin.js"></script>
<script type="text/javascript">
<!--
mview_name="MView";
mview_mayscript="true";
mview_begin("../../..", 400, 300);
mview_param("mol","C1=CNC=C1");
mview_param("detachable", "false");
mview_param("listenpropertychange","true");
mview_param("listenmouseevent","true");
mview_end();

function propertyChange(prop) {
    var s = document.eventform.txt.value;
    s = s + prop + "\n";
    document.eventform.txt.value = s;
}
function mouseEvent(evt) {
    var s = document.mouseform.txt.value;
    s = s + evt + "\n";
    document.mouseform.txt.value = s;
}
//-->
</script>
The code of the 2 used HTML forms are shown below:
<form name="eventform">
<textarea name="txt" rows=10 cols=40 readonly>
</textarea>
</form>


<form name="mouseform">
<textarea name="txt" rows=10 cols=40 readonly>
</textarea>
</form>