GeoGebraApplet: java2javascript interface added

Markus Hohenwarter shared this question 13 years ago
Answered

Hello everyone,


I have implemented an Applet to JavaScript interface for the GeoGebraApplet. You can now have JavaScript functions that listen for object updates, new objects, deleted objects, etc. in the applet's construction. This means that the GeoGebraApplet can now actively influence your website. Furthermore, this is a way to let two GeoGebraApplets communicate with each other (in both directions!) by providing JavaScript code in the webpage as a bridge.


The new features are included in the latest pre-release. Please have a look at the details in

http://www.geogebra.org/sou...

an example:

http://www.geogebra.org/sou...


I will now go on to create a new method for "getAllObjectNames()" as it only works on Firefox and not with IE.


All the best,

Markus

Comments (4)

photo
1

Hi Markus


Thanks for this. An excellent feature.

I tried it with Firefox 2.0.0.1 and noticed this:

Clicking the Reset icon or the browser Refresh button resets the construction as expected.

But if the 'Listen for updates' checkbox has been checked the checkbox and the Listener output appear to freeze.

Clicking the checkbox unfreezes and clears them.


All the Best

Zen Biker Maniac

photo
1

The browser refresh/reload button can be made to reset the form.

Insert a call to resetForm() into the body tag:


<body onLoad="resetForm()">


Insert a new function resetForm() after the <script ...> tag:


<script type="text/javascript">


function resetForm() {

document.listenerForm.textfield.value = "";

document.listenerForm.textarea.value = "";

document.listenerForm.cbA.click();

document.listenerForm.cbB.click();

document.listenerForm.cbAddRemoveRename.click();

} //end resetForm


The problem remains with the GeoGebra reset icon.


Zen Biker Maniac

photo
1

Yes, I know about this problem in Firefox, but could not find a solution for it, as I am not really sure what causes the problem. With IE it did not occur.

So, simply avoid the reset icon when using Java2Javascript.


I have updated the java2javascript interface a little bit and

added another example for applet to applet communication:

http://www.geogebra.org/sou...

examples:

http://www.geogebra.org/sou...

http://www.geogebra.org/sou...


All the best,

Markus

photo
1

Congraluations,


I'it exactly what I need, it's wonderfull. But when do you sleep ;)

© 2020 International GeoGebra Institute