Diferencia entre revisiones de «Referencia:JavaScript»

De GeoGebra Manual
Saltar a: navegación, buscar
 
(No se muestran 94 ediciones intermedias de 4 usuarios)
Línea 1: Línea 1:
Este documento describe métodos públicos disponibles en geogebra.GeoGebraApplet que pueden emplearse desde una página HTML vía JavaScript.
+
{{Referencia}}__NOTOC__
 +
{{warning|1=<br>Se recomienda dirigirse a [https://wiki.geogebra.org/en/Reference:GeoGebra_Apps_API la versión en inglés] para distinguir actualizaciones aún no reflejadas en otros idiomas.}}
 +
<hr>
 +
Este artículo describe cómo se puede interactuar con aplicaciones GeoGebra (applet) vía JavaScript. La aplicación ''applet'' GeoGebra está representada por un objeto  JavaScript, que en este documento se como almacenado en una variable denominada ggbApplet.<br>Tal presunción se corrobora si se está empleando JavaScript desde el interior de GeoGebra o si se lo está usando en una página ''web'' con una aplicación individual ''applet'' de GeoGebra exportada, sea desde GeoGebra directamente ({{KeyCode|Ctrl + Shift+M}}) o desde GeoGebra con el enlace del paquete denominado Offline Package.<br>
 +
Los guiones <u>'''no'''</u> está disponible para aplicaciones ''applets'' exportadas desde GeoGebra vía el dispositivo para incrustar (''Embed feature'').<br>En caso de múltiples ''applets'' debe consultarse la sección [[#Obtención del Objeto Applet|Obtención del Objeto Applet]].
  
= Ejemplos =
+
<small><h3>Documento Previo</h3>
Ejemplo 1: the following HTML code fragment adds a "Reset" button to an HTML page that lets the user reset the construction shown in the GeoGebraApplet to its initial state:
+
Este documento describe métodos públicos disponibles en  geogebra.GeoGebraApplet que pueden emplearse desde una página HTML  vía JavaScript.</small>
 +
===Ejemplos===
 +
'''Ejemplo 1:'''<br>El siguiente fragmento de código  HTML añade un botón de reinicio ("Reset") a una página  HTML que permite reiniciar la construcción expuesta en el Applet de GeoGebra para que recupere su estado inicial:
 +
<code> <form><br/><input type="button" value="Réinitialiser" onclick="ggbApplet.reset();"><br/></form></code>
  
  <form>
+
'''Ejemplo 2:''' <br>Esto añade dos botones "Oculta A" y "Expone A" cambia el estado de visibilidad de  un objeto llamado "A" en la construcción<br/>
    <input type="button" value="Reset" onclick="document.applets[0].reset();">
+
<code> <form><br/><input type="button" value="Cacher A" onclick="ggbApplet.setVisible('A', false);"><br/><input type="button" value="Afficher A" onclick="ggbApplet.setVisible('A', true);"><br/></form></code>
  </form>
+
<!--
 
+
'''Ejemplo 3:'''<br>Una función JavaScript "myLittleConstruction()" se emplea para llamar varios  métodos del Applet de GeoGebra.<br><br> 
Ejemplo 2: this adds two buttons "Hide A" and "Show A" change the visibility state of an object named "A" in the construction
 
  
   <form>
+
   <script type="text/javascript" language="javascript" src="http://www.geogebra.org/web/4.4/web/web.nocache.js"></script>
    <input type="button" value="Hide A" onclick="document.applets[0].setVisible('A', false);">
+
   <article class="geogebraweb" data-param-width="500" data-param-height="500" data-param-ggbbase64="UEsDBBQACAgIAM1CWUMAAAAAAAAAAAAAAAAWAAAAZ2VvZ2VicmFfamF2YXNjcmlwdC5qc0srzUsuyczPU0hPT/LP88zLLNHQVKiuBQBQSwcI1je9uRkAAAAXAAAAUEsDBBQACAgIAM1CWUMAAAAAAAAAAAAAAAAMAAAAZ2VvZ2VicmEueG1svVZtb9s2EP6c/oqDPicxSVGyHMgp1gIFCmTdgHTDsG+URMtcZFEQKb8M/fE7kpIjpy/o0GFB7CN5D++5O96Rzl8fdw3sZW+UbtcRvSURyLbUlWrrdTTYzU0Wvb5/lddS17LoBWx0vxN2HXGHVNU62iSblBPGbgou0hu+yuKbjONXucrKpCJVma14BHA06q7VH8ROmk6U8rHcyp140KWwnnhrbXe3WBwOh9uJ6lb39aKui9ujqSJAN1uzjsbBHZq72HSIPZwRQhd//PwQzN+o1ljRljICF8Kg7l9d5QfVVvoAB1XZ7TrKCIaxlareYkypmywcqMOEdLK0ai8Nbp1Nfcx210UeJlqnvwojaM7hRFCpvapkv47ILUsi0L2SrR21dGRZTPvzvZKHYMiNPAcmzWrdFMLZgE+fgBFG4NoJGgRDkaZBRcIaiYNgQfAgkoDhYTsPUB4wPGB4HMFeGVU0Eo9UNAZzptpNj+d1nht7aqT3Z1x4jpdeY0xG/Y3g2CUxJBnXCbl2H8zsNZ+yOwuSzlhtP/xL0olymbHvp2Q/FGg8cbIvhcmSr4SZfoM0xP09cdJkxolU/t9/PmOMvxXmS8Yw/zHClP8vIeaLqVXysTvAbB12rB4rd8b1S7yCZOXKnkKCvZEuscoToCsUSwbYDUAT4AlOaQapk0uIl6jgEEMGDkdj8M2RZPjFl95YCgkac6tL7EmgSMQhiYH6nuKAnQS+L7FHWYyIJIEENzl6ypyJOAWe4izOgKOPriWXFIExbsQ50jOIKcRuM10CSyF19ih3rZ5mznU0ySAlkFJnELsaOzp0M+IziF006Zgu1XaDvUhRuaumodXd+SwQjffR8z0X7qeLa/Aqb0QhG3wZHt1JAuxF4zrCE210a2E6RBbW6l50W1WaR2kt7jLwl9iLB2Hl8R2izcTtsaVuza+9tm91M+xaA1Dqhpx91g2djdnZa5zEMwWfK5KZIp2Nl1/k1aiBwUjk172Z4KKq3jvE89WAmfylbU5veimeOq0uw8gX/pHJ5VA2qlKi/R2L1bG4vMD05vjranpzOKOTI7qvHk8GKxiOf8pe4x1Dk1sy/8Pb5xRU8UsVHrgphWu+hFxqsLdOX1PxwC335yMSR3mOvu5VNR+/N290U51z4cN/Kzo79P7XAnrXu6B+autG+hLxjY1PcflU6ONjqI042Pp46nBGAn9R+7QDXg0swdeyHmURpMc4x84o4jHEI8hUbKo66+mKeYSXRZAehdUbXBsDpVOUlEw0yvgLjUQXbeNL3z3sQ6vswzSxqnx6jtThPwy7Qp4L6NIk/Y9M5osXBZY/yb6VzVjPeJCDHkxoz1mpV7JUO5wGxZgQ4Q7rN3QgrFay7uXkd+N/h4V0eS2Zl+pny97Uu17v3rf7j1gJLxzIF5OXuSl71bl6gwLfgCf5XFOVMgKfkGq+zzUghl66pwLTY11qsDUHu9W9/6mFNwpKxzCH+nYcf0ve/wNQSwcI2ajKq1gEAADoCgAAUEsBAhQAFAAICAgAzUJZQ9Y3vbkZAAAAFwAAABYAAAAAAAAAAAAAAAAAAAAAAGdlb2dlYnJhX2phdmFzY3JpcHQuanNQSwECFAAUAAgICADNQllD2ajKq1gEAADoCgAADAAAAAAAAAAAAAAAAABdAAAAZ2VvZ2VicmEueG1sUEsFBgAAAAACAAIAfgAAAO8EAAAAAA=="></article>
    <input type="button" value="Show A" onclick="document.applets[0].setVisible('A', true);">
 
  </form>
 
 
 
Ejemplo 3: a JavaScript function "myLittleConstruction()" is used to call several methods of the GeoGebraApplet. Note: the language is set to German ("de") with the applet parameter "language" in the applet tag in order to make sure that the German command "Gerade" (line) will work.
 
 
 
  <applet name="ggbApplet" code="geogebra.GeoGebraApplet"
 
    archive="geogebra.jar"
 
    codebase="http://jars.geogebra.org/webstart/4.0/unsigned/"
 
    width=200 height=40>
 
  <param name="filename" value="circle.ggb">
 
   <param name="framePossible" value="false">
 
  <param name="language" value="de">
 
  Please <a href="http://www.java.com">install Java 1.4.2</a> (or later) to use this page.
 
  </applet>
 
 
   <script type="text/javascript">
 
   <script type="text/javascript">
     function myLittelConstruction() {
+
     function myLittleConstruction() {
 
       var applet = document.ggbApplet;
 
       var applet = document.ggbApplet;
 
       applet.evalCommand("A = (1,1)");  
 
       applet.evalCommand("A = (1,1)");  
 
       applet.evalCommand("B = (3,2)");  
 
       applet.evalCommand("B = (3,2)");  
       applet.evalCommand("s = Gerade[A, B]");  
+
       applet.evalCommand("s = Line[A, B]");  
 
     }
 
     }
 
   </script>
 
   </script>
 
   <form>
 
   <form>
     <input type="button" value="Do construction" onclick="myLittelConstruction();">
+
     <input type="button" value="Do construction" onclick="myLittleConstruction();">
 
   </form>
 
   </form>
  
Ejemplo 4: Have a look at the source code of the following example worksheet that uses JavaScript.
+
'''Ejemplo 4: '''<br>Conviene revisar el código fuente del siguiente ejemplo de hoja dinámica que emplea JavaScript: [http://www.geogebra.org/source/program/applet/geogebra_applet_javascript_test.htm ejemplo_4]
  http://www.geogebra.org/source/program/applet/geogebra_applet_javascript_test.htm
 
  
Ejemplo 5: This is an example worksheet that uses an ''add listener'' to check when a particular construction has been completed (and then says "Well done").
+
'''Ejemplo 5: '''<br>Este es un ejemplo de hoja dinámica que emplea un ''sensor'' (''add listener'') para  controlas cuándo una construcción particular se ha completado (y luego expresa "¡Bien hecho!" - en inglés ''Well done''.).<br>Ver [http://www.geogebra.org/en/examples/javascriptAutomaticCheckingExercise.html ''add listener'']
  http://www.geogebra.org/en/examples/javascriptAutomaticCheckingExercise.html
 
  
= Métodos Disponibles =
+
'''Ejemplo 6:'''<br>Este es un ejemplo que ilustra la interfaz de JavaScript de GeoGebraWeb[http://archive.geogebra.org/examples/SlopeTestWeb.html Prueba de Pendiente (SlopeTest)]:<br>
 +
http://archive.geogebra.org/examples/SlopeTestWeb.html
 +
-->
 +
==Métodos Disponibles==
 
<table style="width: 100%;" class="pretty">
 
<table style="width: 100%;" class="pretty">
 
     <tr>
 
     <tr>
       <th>Method Signature</th>
+
       <th>Firma del Método</th>
       <th style="text-align: center;">Since</th>
+
       <th style="text-align: center;">Desde</th>
       <th>Description</th>
+
       <th>Descripción</th>
    </tr>
+
      <tr>
    <tr>
 
 
       <td>boolean evalCommand(String cmdString)</td>
 
       <td>boolean evalCommand(String cmdString)</td>
 
       <td style="text-align: center;">3.0</td>
 
       <td style="text-align: center;">3.0</td>
       <td> Evaluates the given string just like it would be evaluated when entered into GeoGebra's input bar. Returns whether command evaluation was successful. <br> From GeoGebra 3.2 you can pass multiple commands at once by separating them with \n. <br> Note: use the [[Referencia:Parámetros Applet|language parameter]] to ensure your local command names will work.<br>
+
       <td> Evalúa la cadena dada como cuando se la ingresa desde la Barra de Entrada de GeoGebra. Da por resultado si fue exitosa la evaluación. <br> A partir de GeoGebra 3.2 se pueden  pasar múltiples comandos de a una vez separando cada uno de ellos con \n. <br>{{Note|1=Usar los nombres de los comandos en inglés para asegurarse su correcta operatoria con todas las versiones de GeoGebra.<br>La alternativa sería acudir al [[Referencia:Parámetros Applet|parámetro del idioma (''language'')]] para controlar que operen correctamente los nombres de los comandos.}}<br>
 +
    </td>
 +
    </tr>
 +
    <tr>
 +
    <td>String evalCommandCAS(Cadena cadena) </td>
 +
    <td style="alineación del texto al centro - text-align: center;">3.2</td>
 +
    <td>Pasa la ''cadena'' al CAS de GeoGebra y da el resultado como una ''Cadena''.<br>
 
       </td>
 
       </td>
 
     </tr>
 
     </tr>
Línea 60: Línea 58:
 
       <td>void setUndoPoint()</td>
 
       <td>void setUndoPoint()</td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td> Sets an undo point. Useful if you want the user to be able to undo that action of evalCommand eg if you have made an HTML button to act as a custom tool<br>
+
       <td> Fija un punto de ''deshace''. Útil cuando se quiere que el usuario pueda deshacer lo que la acción de evalCommand, por ejemplo si se ha hecho un botón HTML para actuar como una herramienta de usuario<br>
 
       </td>
 
       </td>
 
     </tr>
 
     </tr>
 
</table>
 
</table>
With these methods you can implement Applet to JavaScript communication. When you use any of the following methods, you should make sure to insert the MAYSCRIPT option add the end of the first line of your applet tag. For example:
+
Con estos métodos se puede implementar comunicaciones Applet a JavaScript. Cuando se los emplea, es preciso asegurarse de haber insertado la opción MAYSCRIPT añadida al final de la primera línea de la etiqueta del ''applet'' (applet tag). Por eejmplo:<br><code>  <applet name="ggbApplet" code="geogebra.GeoGebraApplet" codebase="."<br>archive="geogebra.jar" width="500" height="250" MAYSCRIPT></code>
  <applet name="ggbApplet" code="geogebra.GeoGebraApplet" codebase="." archive="geogebra.jar" width="500" height="250" MAYSCRIPT>
+
La opción MAYSCRIPT solo se requiere para comunicaciones GeoGebraApplet a JavaScript; no es  necesaria para métodos de acceso de JavaScript GeoGebraApplet.  
The MAYSCRIPT option is only needed for GeoGebraApplet to JavaScript communication; it is not needed for JavaScript to access the GeoGebraApplet methods.  
+
<!--
 
+
Por ejemplo, estos métodos se pueden emplear para
For example, these methods can be used to
+
*controlar las acciones del usuario {{Note|1=Ver el ejemplo [http://www.geogebra.org/source/program/applet/geogebra_applet_java2javascript.htm java2javascript ejemplo]}}
* monitor user actions (see [http://www.geogebra.org/source/program/applet/geogebra_applet_java2javascript.htm java2javascript example] ) or
+
*comunicar entre dos applets de GeoGebra {{Note|1= Ver el ejemplo [http://www.geogebra.org/source/program/applet/geogebra_applet_java2java.htm ejemplo java2java].}}
* communicate between two GeoGebra applets (see [http://www.geogebra.org/source/program/applet/geogebra_applet_java2java.htm java2java example] ).
+
-->
 +
=Fijando Estado de Objetos=
  
= Estableciendo el Estado de los Objetos =
 
 
==Métodos Generales==
 
==Métodos Generales==
 
  <table style="width: 100%;" class="pretty">
 
  <table style="width: 100%;" class="pretty">
 
     <tr>
 
     <tr>
       <th>Método de Firma (Signature)</th>
+
       <th>Firma del Método</th>
       <th style="text-align: center;">Since</th>
+
       <th style="text-align: center;">Desde</th>
 
       <th>Descripción</th>
 
       <th>Descripción</th>
     </tr>
+
     </tr>  
     <tr>
+
     <tr>  
 
       <td> void deleteObject(String objName)</td>
 
       <td> void deleteObject(String objName)</td>
 
       <td style="text-align: center;">2.7</td>
 
       <td style="text-align: center;">2.7</td>
       <td>Deletes the object with the given name.</td>
+
       <td>Elimina el objeto del nombre dado.</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>void setValue(String objName, double value)</td>
 
       <td>void setValue(String objName, double value)</td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td>Sets the double value of the object with the given name. Note: if the specified object is boolean, use a value of 1 to set it to true and any other value to set it to false. For any other object type, nothing is done.</td>
+
       <td>Fija el doble valor del objeto con el nombre dado. Atención: si el objeto especificado es  booleano, se debe usar el valor 1 para establecerlo como verdadero y cualquier otro, para falso. Para cualquier otro tipo de objeto, no se hace nada.</td>
 +
    </tr>
 +
    <tr>
 +
    <td>setTextValue(nombre, texto)</td>
 +
<td style="text-align: center;">5.0</td>
 +
    <td>Afecta al texto del objeto de texto referido. No tiene efecto sobre cualquier otro tipo de objeto.</td>
 +
    </tr>
 +
    <tr>
 +
    <td>void setListValue(String objName, int i, double value)</td>
 +
      <td style="text-align: center;">5.0</td>
 +
      <td>Fija el valor del elemento de la lista en la posición 'i' al valor 'value'</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>void setCoords(String objName, double x, double y)</td>
 
       <td>void setCoords(String objName, double x, double y)</td>
 
       <td style="text-align: center;">3.0</td>
 
       <td style="text-align: center;">3.0</td>
       <td>Sets the coordinates of the object with the given name.
+
       <td>Fija las coordenadas del objeto del nombre dado.
Note: if the specified object is not a point or a vector, nothing is done.</td>
+
Atención: si el objeto especificado no es un punto o un vector, no se hace nada.</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
Línea 100: Línea 108:
 
blue)</td>
 
blue)</td>
 
       <td style="text-align: center;">2.7</td>
 
       <td style="text-align: center;">2.7</td>
       <td>Sets the color of the object with the given name.</td>
+
       <td>Fija el color del objeto con el nombre dado.</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>void setVisible(String objName, boolean visible) </td>
 
       <td>void setVisible(String objName, boolean visible) </td>
 
       <td style="text-align: center;">2.7</td>
 
       <td style="text-align: center;">2.7</td>
       <td>Shows or hides the object with the given name in the graphics window.</td>
+
       <td>Muestra u oculta el objeto con el nombre dado en la vista gráfica.</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>void setLabelVisible(String objName, boolean visible) </td>
 
       <td>void setLabelVisible(String objName, boolean visible) </td>
 
       <td style="text-align: center;">3.0</td>
 
       <td style="text-align: center;">3.0</td>
       <td>Shows or hides the label of the object with the given name in the graphics window.</td>
+
       <td>Muestra u oculta los rótulos del objeto con el nombre dado en la vista gráfica.</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
       <td>void setLabelStyle(String objName, boolean visible)</td>
+
       <td>void setLabelStyle(String objName, int style)</td>
 
       <td style="text-align: center;">3.0</td>
 
       <td style="text-align: center;">3.0</td>
       <td>Sets the label style of the object with the given name in the graphics window. Possible label styles are NAME = 0, NAME_VALUE = 1, VALUE = 2 and (from GeoGebra 3.2) CAPTION = 3</td>
+
       <td>Fija el estilo del rótulo del objeto con el nombre dado en la vista gráfica. Los estilos de rótulo posibles son NOMBRE = 0, NOMBRE_VALOR = 1, VALOR = 2 y (a partir de GeoGebra 3.2) SUBTITULO = 3</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>void setFixed(String objName, boolean flag)</td>
 
       <td>void setFixed(String objName, boolean flag)</td>
 
       <td style="text-align: center;">3.0</td>
 
       <td style="text-align: center;">3.0</td>
       <td>Sets the fixed state of the object with the given name. Note: fixed objects cannot be changed.</td>
+
       <td>Establecer el estado fijo del objeto con el nombre dado. Atención: los objetos fijos no puede modificarse.</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>void setTrace(String objName, boolean flag)</td>
 
       <td>void setTrace(String objName, boolean flag)</td>
 
       <td style="text-align: center;">3.0</td>
 
       <td style="text-align: center;">3.0</td>
       <td>Turns the trace of the object with the given name on or off.</td>
+
       <td>Activa o desactiva el rastro del objeto con el nombre dado.</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>boolean renameObject(String oldObjName, String newObjName)</td>
 
       <td>boolean renameObject(String oldObjName, String newObjName)</td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td>Renames oldObjName to newObjName. Returns whether the rename was successful</td>
+
       <td>Cambia el nombre del objeto del previo, oldObjName al nuevo,  newObjName. Indica si se ha logrado renombrarlo</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>void setLayer(String objName)</td>
 
       <td>void setLayer(String objName)</td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td>Sets the layer of the object</td>
+
       <td>Fija la capa del objeto</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>void setLayerVisible(int layer, boolean visible)</td>
 
       <td>void setLayerVisible(int layer, boolean visible)</td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td>Shows or hides the all objects in the given layer</td>
+
       <td>Muestra u ocular todos los objetos en la capa dada</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>void setLineStyle(String objName, int style)</td>
 
       <td>void setLineStyle(String objName, int style)</td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td>Sets the line style for the object (0 to 4)</td>
+
       <td>Fija el estilo del trazo para el objeto (0 a 4)</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>void setLineThickness(String objName, int thickness)</td>
 
       <td>void setLineThickness(String objName, int thickness)</td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td>sets the thickness of the object (1 to 13, -1 for default)</td>
+
       <td>Fija el grosor del objeto (1 a 13, -1 por omisión)</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>void setPointStyle(String objName, int style)</td>
 
       <td>void setPointStyle(String objName, int style)</td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td>Sets the style of points (-1 default, 0 filled circle, 1 circle, 2 cross, 3 plus, 4 filled diamond, 5 unfilled diamond, 6 triangle (north), 7 triangle (south), 8 triangle (east), 9 triangle (west))</td>
+
       <td>Fija el estilo de los puntos (-1 por omisión, 0 redondel sombreado, 1 redondel hueco, 2 cuz, 3 signo más, 4 rombo sombreado, 5 rombo hueco, 6 triángulo (al norte), 7 triángulo (al sur), 8 triángulo (al este), 9 triángulo (al oeste))</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>void setPointSize(String objName, int size)</td>
 
       <td>void setPointSize(String objName, int size)</td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td>Sets the size of a point (from 1 to 9)</td>
+
       <td>Fija el tamaño del punto (desde 1 a 9)</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>void setFilling(String objName, double filling)</td>
 
       <td>void setFilling(String objName, double filling)</td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td>Sets the filling of an object (from 0 to 1)</td>
+
       <td>Fija el sombreado de un objeto (desde 0 a 1)</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>String getPNGBase64(double exportScale, boolean transparent, double DPI)</td>
 
       <td>String getPNGBase64(double exportScale, boolean transparent, double DPI)</td>
 
       <td style="text-align: center;">4.0</td>
 
       <td style="text-align: center;">4.0</td>
       <td>Returns Graphics View 1 as a base64-encoded String<br>eg var str = ggbApplet.getPNGBase64(1, true, 72);      </td>
+
       <td>Da por resultado la cadena de la Vista Gráfica 1 codificada en base64<br>eg var str = ggbApplet.getPNGBase64(1, true, 72);      </td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
Línea 176: Línea 184:
 
</td>
 
</td>
 
       <td style="text-align: center;">4.0</td>
 
       <td style="text-align: center;">4.0</td>
       <td>Exports Graphics View 1 to a .PNG file '''(signed applets only)''' <br>
+
       <td>Exporta la Vista Gráfica 1 a un archivo .PNG '''(solo para ''signed applets'', firmadas)''' <br>
 
eg var success = ggbApplet.writePNGtoFile("c:\\test.png", 1, false, 300);      </td>
 
eg var success = ggbApplet.writePNGtoFile("c:\\test.png", 1, false, 300);      </td>
 
     </tr>
 
     </tr>
Línea 183: Línea 191:
 
</td>
 
</td>
 
       <td style="text-align: center;">4.0</td>
 
       <td style="text-align: center;">4.0</td>
       <td> checks if '''objName''' is independent      </td>
+
       <td> Controla si el objeto del nombre dado,  '''objName''',  es independiente    </td>
 
     </tr>
 
     </tr>
 
   <tr>
 
   <tr>
Línea 189: Línea 197:
 
</td>
 
</td>
 
       <td style="text-align: center;">4.0</td>
 
       <td style="text-align: center;">4.0</td>
       <td> checks if '''objName''' is is moveable</td>
+
       <td> Controla si el objeto del nombre dado, '''objName''' es desplazable</td>
 
     </tr>
 
     </tr>
 
   <tr>
 
   <tr>
 
       <td>String getBase64()
 
       <td>String getBase64()
 
</td>
 
</td>
       <td style="text-align: center;">4.0</td>
+
       <td style="text-align: center;"></td>
       <td> Gets the current construction as a base64-encoded .ggb file</td>
+
       <td> Da por resultado la construcción activa como un archivo .ggb codificado en base64</td>
 
     </tr>
 
     </tr>
 +
  <tr>
 +
      <td>Cadena getBase64(función de llamada-callback-)
 +
</td>
 +
      <td style="text-align: center;">4.2 (solo HTML5)</td>
 +
      <td> Da por resultado la construcción activa como un archivo .ggb codificado en base64 asincrónicamente, pasando como parámetro a la función de llamada -callback-  al estar lista. La función de llamada -callback-debiera tomar un parámetro (la cadena base64).</td>
 +
    </tr><tr>
 
       <td>void setBase64(String)
 
       <td>void setBase64(String)
 
</td>
 
</td>
       <td style="text-align: center;">4.0</td>
+
       <td style="text-align: center;">4.0 (solo Java)</td>
       <td> Sets the current construction from a base64-encoded .ggb file</td>
+
       <td> Establece la construcción activa desde un archivo .ggb codificado como base64</td>
    </tr>
+
</tr>
</table>
+
  <tr>
 +
      <td>Cadena getBase64(función de llamada-callback-)
 +
</td>
 +
      <td style="text-align: center;">4.2 (solo HTML5)</td>
 +
      <td> Da por resultado la construcción activa como un archivo .ggb codificado en base64 asincrónicamente, pasando como parámetro a la función de llamada -callback-  al estar lista. La función de llamada -callback-debiera tomar un parámetro (la cadena base64).</td>
 +
</table>
  
==Animación Automática==
+
===Animación Automática===
 
<table style="width: 100%;" class="pretty">
 
<table style="width: 100%;" class="pretty">
 
     <tr>
 
     <tr>
       <th>Method Signature</th>
+
       <th>Firma del Método</th>
       <th style="text-align: center;">Since</th>
+
       <th style="text-align: center;">Desde</th>
       <th>Description</th>
+
       <th>Descripción</th>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>void setAnimating(String objName, boolean animate)</td>
 
       <td>void setAnimating(String objName, boolean animate)</td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td>Sets whether an object should be animated. This does not start the animation yet, use startAnimation() to do so.</td>
+
       <td>Establece la posibilidad de animar un objeto. No inicia la animación, para eso debe emplearse startAnimation(), simplemente indica su viabilidad.</td>
 
     </tr>
 
     </tr>
 
       <tr>
 
       <tr>
 
       <td>void setAnimationSpeed(String objName, double speed)</td>
 
       <td>void setAnimationSpeed(String objName, double speed)</td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td>Sets the animation speed of an object.</td>
+
       <td>Establece la velocidad de animación de un objeto.</td>
 
     </tr>
 
     </tr>
 
   <tr>
 
   <tr>
 
       <td>void startAnimation()</td>
 
       <td>void startAnimation()</td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td>Starts automatic animation for all objects with the animating flag set, see setAnimating()</td>
+
       <td>Inicia la animación automática para todos los objetos que la tuvieran indicada (''flag'' o bandera de animación así fijada, ver setAnimating())</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>void stopAnimation()</td>
 
       <td>void stopAnimation()</td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td>Stops animation for all objects with the animating flag set, see setAnimating()</td>
+
       <td>Detiene la animación automática para todos los objetos que la tuvieran indicada (''flag'' o bandera de animación así fijada, ver setAnimating())</td>
 
     </tr>
 
     </tr>
 
   <tr>
 
   <tr>
 
       <td>boolean isAnimationRunning()</td>
 
       <td>boolean isAnimationRunning()</td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td>Returns whether automatic animation is currently running.</td>
+
       <td>Da por resultado el dato que establece si la animación automática está activa.</td>
 
     </tr>
 
     </tr>
 
</table>
 
</table>
  
= Sobre el Estado de los Objetos =
+
=Sobre Estado de Objetos=
  
 
<table style="width: 100%;" class="pretty">
 
<table style="width: 100%;" class="pretty">
 
     <tr>
 
     <tr>
       <th>Method Signature</th>
+
       <th>Firma del Método</th>
       <th style="text-align: center;">Since</th>
+
       <th style="text-align: center;">Desde</th>
       <th>Description</th>
+
       <th>Descripción</th>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>double getXcoord(String objName)</td>
 
       <td>double getXcoord(String objName)</td>
 
       <td style="text-align: center;">2.7</td>
 
       <td style="text-align: center;">2.7</td>
       <td>Returns the cartesian x-coord of the object with the given name.
+
       <td>Devuelve la coordenada cartesiana x del objeto con el nombre dado. Atención: Devuelve 0 si el objeto no es un punto o un vector.</td>
Note: returns 0 if the object is not a point or a vector.</td>
 
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>double getYcoord(String objName)</td>
 
       <td>double getYcoord(String objName)</td>
 
       <td style="text-align: center;">2.7</td>
 
       <td style="text-align: center;">2.7</td>
       <td>Returns the cartesian y-coord of the object with the given name.
+
       <td>Devuelve la ordenada cartesiana-y- del objeto con el nombre dado. Atención: Devuelve 0 si el objeto no es un punto o un vector..</td>
Note: returns 0 if the object is not a point or a vector.</td>
 
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>double getValue(String objName)</td>
 
       <td>double getValue(String objName)</td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td>Returns the double value of the object with the given name (e.g. length of segment, area of polygon). Note: returns 1 for a boolean object with value true. Otherwise 0 is returned.<br>
+
       <td>Devuelve el doble valor del objeto con el nombre dado (por ejemplo, la longitud de un segmento, el área de un polígono). Atención: Devuelve 1 si el objeto es una variable booleana con valor cierto -true- y en cualquier otro caso,  0.<br>
 +
  </td>
 +
</tr>
 +
  <tr>
 +
    <td>double getListValue(String objName, Integer index)</td>
 +
      <td style="text-align: center;">5.0</td>
 +
  <td>Devuelve el doble valor del objeto de la lista (con el nombre dado) según el índice establecido. <u>Atención</u>: da 1 para un objeto booleano con valor verdadero y 0 en caso contrario, si es falso.<br>
 
       </td>
 
       </td>
 
     </tr>
 
     </tr>
Línea 267: Línea 290:
 
       <td>String getColor(String objName)</td>
 
       <td>String getColor(String objName)</td>
 
       <td style="text-align: center;">2.7</td>
 
       <td style="text-align: center;">2.7</td>
       <td>Returns the color of the object with the given name as a hex string, e.g. "#FF0000" for red. Note that the hex string always starts with # and contains no lower case letters.</td>
+
       <td>Devuelve el color del objeto especificado del objeto con el nombre dado, como una cadena hexadecimal, por ejemplo,. "# FF0000" es rojo. La cadena hexadecimal siempre comienza con # y no contiene letras minúsculas.</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td> boolean getVisible(String objName)</td>
 
       <td> boolean getVisible(String objName)</td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td>Returns true or false depending on whether the object is visible in the Graphics View. Returns false if the object does not exist.</td>
+
       <td>Devuelve verdadero o falso dependiendo de si el objeto es visible o no en la Vista Gráfica. Devuelve ''false'' si el objeto no existe.</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td> String getValueString(String objName)</td>
 
       <td> String getValueString(String objName)</td>
 
       <td style="text-align: center;">2.7</td>
 
       <td style="text-align: center;">2.7</td>
       <td>Returns the value of the object with the given name as a string.</td>
+
       <td>Devuelve una cadena que contiene el valor del objeto indicado.</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>String getDefinitionString(String objName) </td>
 
       <td>String getDefinitionString(String objName) </td>
 
       <td style="text-align: center;">2.7</td>
 
       <td style="text-align: center;">2.7</td>
       <td>Returns the definition of the object with the given name as a string.</td>
+
       <td>Devuelve una cadena que contiene la definición del objeto indicado.</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>String getCommandString(String objName)</td>
 
       <td>String getCommandString(String objName)</td>
 
       <td style="text-align: center;">2.7</td>
 
       <td style="text-align: center;">2.7</td>
       <td>Returns the command of the object with the given name as a string.</td>
+
       <td>Devuelve una cadena que contiene el comando del objeto del nombre dado.</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>String getObjectType(String objName)</td>
 
       <td>String getObjectType(String objName)</td>
 
       <td style="text-align: center;">2.7</td>
 
       <td style="text-align: center;">2.7</td>
       <td>Returns the type of the given object as a string (like "point", "line", "circle", etc.).</td>
+
       <td>Devuelve una cadena que contiene el tipo de objeto determinado (como el "punto", "recta", "círculo", etc.).</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>boolean exists(String objName)</td>
 
       <td>boolean exists(String objName)</td>
 
       <td style="text-align: center;">2.7</td>
 
       <td style="text-align: center;">2.7</td>
       <td>Returns whether an object with the given name exists in the construction.</td>
+
       <td>Indica si un objeto con el nombre dado existe o no en la construcción.</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>boolean isDefined(String objName)</td>
 
       <td>boolean isDefined(String objName)</td>
 
       <td style="text-align: center;">2.7</td>
 
       <td style="text-align: center;">2.7</td>
       <td>Returns whether the given object's value is valid at the moment.</td>
+
       <td>Devuelve si el valor del objeto especificado es actualmente válido.</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
Línea 308: Línea 331:
 
       <small style="font-style: italic; font-weight: bold;">Deprecated since 3.0</small> </td>
 
       <small style="font-style: italic; font-weight: bold;">Deprecated since 3.0</small> </td>
 
       <td style="text-align: center;">2.7</td>
 
       <td style="text-align: center;">2.7</td>
       <td>Returns an array with all object names in the construction.
+
       <td>Devuelve una matriz que contiene los nombres de todos los objetos en la construcción. Atención: El uso de matrices en JavaScript crea problemas con algunos navegadores.Es  preferible emplear getObjectNumber () y getObjectName ().</td>
Note: using arrays in JavaScript causes problems with some browsers. Use getObjectNumber() and getObjectName() instead.</td>
 
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>int getObjectNumber()</td>
 
       <td>int getObjectNumber()</td>
 
       <td style="text-align: center;">3.0</td>
 
       <td style="text-align: center;">3.0</td>
       <td>Returns the number of objects in the construction.</td>
+
       <td>Devuelve el número de objetos en la construcción .</td>
 
     </tr>
 
     </tr>
 
   <tr>
 
   <tr>
 
       <td>String getObjectName(int i)</td>
 
       <td>String getObjectName(int i)</td>
 
       <td style="text-align: center;">3.0</td>
 
       <td style="text-align: center;">3.0</td>
       <td>Returns the name of the n-th object of the construction.</td>
+
       <td>Devuelve el nombre del objeto enésimo de la construcción.</td>
 
     </tr>
 
     </tr>
 
   <tr>
 
   <tr>
 
       <td>String getLayer(String objName)</td>
 
       <td>String getLayer(String objName)</td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td>Returns the layer of the object.</td>
+
       <td>Devuelve la capa a la que está destinado el objeto.</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>int getLineStyle(String objName)</td>
 
       <td>int getLineStyle(String objName)</td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td>Gets the line style for the object (0 to 4)</td>
+
       <td>Detecta el estilo de línea del objeto indicado (estilo de 0 a 4).)</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>int getLineThickness(String objName)</td>
 
       <td>int getLineThickness(String objName)</td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td>Gets the thickness of the line (1 to 13)</td>
+
       <td>Detecta el ancho de línea (1 a 13)</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>int getPointStyle(String objName)</td>
 
       <td>int getPointStyle(String objName)</td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td>Gets the style of points (-1 default, 0 filled circle, 1 circle, 2 cross, 3 plus, 4 filled diamond, 5 unfilled diamond, 6 triangle (north), 7 triangle (south), 8 triangle (east), 9 triangle (west))</td>
+
       <td>Detecta el estilo de los puntos  (-1 por omisión; 0 redondel sombreado; 1 redondel hueco; 2 cruz; 3 signo más; 4 diamante sombreado; 5 diamante hueco; 6 triángulo (norte); 7 Triángulo (sur); 8 triángulo (este); 9 Triángulo (oeste))</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>int getPointSize(String objName)</td>
 
       <td>int getPointSize(String objName)</td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td>Gets the size of a point (from 1 to 9)</td>
+
       <td>Detecta el tamaño de un punto (desde  1 a 9)</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>double getFilling(String objName)</td>
 
       <td>double getFilling(String objName)</td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td>Gets the filling of an object (from 0 to 1)</td>
+
       <td>Detecta el tipo de sombreado de un objeto (desde 0 a 1))</td>
 
     </tr>
 
     </tr>
 
</table>
 
</table>
  
= Construcción / Interfaz de Uso =
+
=Construcción / Interfaz de Uso=
  
 
<table style="width: 100%;" class="pretty">
 
<table style="width: 100%;" class="pretty">
 
   <tr>
 
   <tr>
       <th>Method Signature</th>
+
       <th>Firma del Método</th>
       <th style="text-align: center;">Since</th>
+
       <th style="text-align: center;">Desde</th>
       <th style="font-weight: bold;">Description</th>
+
       <th style="font-weight: bold;">Descripción</th>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>void setMode(int mode)</td>
 
       <td>void setMode(int mode)</td>
 
       <td style="text-align: center;">2.7</td>
 
       <td style="text-align: center;">2.7</td>
       <td>Sets the mouse mode (i.e. tool) for the graphics window
+
       <td>Establece el modo de ''mouse'' o ratón (por ejemplo, como una herramienta) en la Vista Gráfica (ver [[Referencia:Barra de Herramientas]] y [Referencia:Parámetros Applet|parámetros applet]] y &nbsp;"customToolBar"  )</td>
(ver [en:Reference:Toolbar|Referencia de Barra de Herramientas] y los [[Referencia:Parámetros Applet|parámetros applet]] "showToolBar" y &nbsp;"customToolBar"  )</td>
 
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>void openFile(String strURL)</td>
 
       <td>void openFile(String strURL)</td>
 
       <td style="text-align: center;">2.7</td>
 
       <td style="text-align: center;">2.7</td>
       <td>Opens a construction from a&nbsp; file (given as absolute or relative URL string)</td>
+
       <td>Abre una construcción desde un archivo (indicado por una cadena con la URL absoluta o relativa)</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>void reset()</td>
 
       <td>void reset()</td>
 
       <td style="text-align: center;">2.7</td>
 
       <td style="text-align: center;">2.7</td>
       <td>Reloads the initial construction (given in filename parameter) of this applet.<br>
+
       <td>Actualizar la construcción inicial (que se indica en el parámetro de nombre de archivo en el applet actual).<br>
 
       </td>
 
       </td>
 
   </tr>
 
   </tr>
Línea 381: Línea 402:
 
       <td>void refreshViews()</td>
 
       <td>void refreshViews()</td>
 
       <td style="text-align: center;">2.7</td>
 
       <td style="text-align: center;">2.7</td>
       <td>Refreshs all views. Note: this clears all traces in the graphics window.</td>
+
       <td>Actualizar todas las vistas. Atención: todos los rastros serán eliminados de la vista gráfica.</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
Línea 387: Línea 408:
 
       </td>
 
       </td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td>Turns on the fly creation of points in graphics view on (true) or off (false). Note: this is useful if you don't want tools to have the side effect of creating points. For example, when this flag is set to false, the tool "line through two points" will not create points on the fly when you click on the background of the graphics view.</td>
+
       <td>Activar (true) o desactivado (false) la creación inmediata de puntos en la vista gráfica. Atención: Es muy útil cuando se desea evitar la creación de puntos como un "efecto secundario" de una herramienta. Por ejemplo, cuando este indicador es falso, la herramienta de "recta  por dos puntos" no crea puntos por el  ''clic'' en la vista gráfica.</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
Línea 393: Línea 414:
 
       </td>
 
       </td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td>Hides (true) or shows (false) the mouse cursor (pointer) when dragging an object to change the construction. </td>
+
       <td>Ocultar (true) o mostrar (false) el cursor del ''mouse'' o ratón (puntero) al arrastrar un objeto para cambiar la construcción.) </td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
Línea 399: Línea 420:
 
       </td>
 
       </td>
 
       <td style="text-align: center;">2.7</td>
 
       <td style="text-align: center;">2.7</td>
       <td>Turns the repainting of this applet on (true) or off (false).
+
       <td>Activar (true) o desactivado (false) repintar el applet. Atención: Este método es eficaz sobre todo cuando son varios los métodos invocados.</td>
Note: use this method for efficient repainting when you invoke several methods.</td>
 
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>void setErrorDialogsActive(boolean flag)</td>
 
       <td>void setErrorDialogsActive(boolean flag)</td>
 
       <td style="text-align: center;">3.0</td>
 
       <td style="text-align: center;">3.0</td>
       <td>Turns showing of error dialogs on (true) or off (false). Note: this is especially useful together with evalCommand().</td>
+
       <td>Activar (true) o desactivado (false) mostrar cuadros de diálogo acerca de los errores. Atención: Es muy útil si se utiliza junto con evalCommand ().</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>void setCoordSystem(double xmin, double xmax, double ymin, double ymax)</td>
 
       <td>void setCoordSystem(double xmin, double xmax, double ymin, double ymax)</td>
 
       <td style="text-align: center;">3.0</td>
 
       <td style="text-align: center;">3.0</td>
       <td>Sets the Cartesian coordinate system of the graphics window.</td>
+
       <td>Establece el sistema de coordenadas cartesianas de la Vista  Gráfica.</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>void setAxesVisible(boolean xAxis, boolean yAxis)</td>
 
       <td>void setAxesVisible(boolean xAxis, boolean yAxis)</td>
 
       <td style="text-align: center;">3.0</td>
 
       <td style="text-align: center;">3.0</td>
       <td>Shows or hides the x- and y-axis of the coordinate system in the graphics window.</td>
+
       <td>Muestra u oculta los ejes x e y del sistema de coordenadas de la Vista Gráfica.</td>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>void setGridVisible(boolean flag) </td>
 
       <td>void setGridVisible(boolean flag) </td>
 
       <td style="text-align: center;">3.0</td>
 
       <td style="text-align: center;">3.0</td>
       <td>Shows or hides the coordinate grid in the graphics window.</td>
+
       <td>Muestra u oculta la cuadrícula de coordenadas de la Vista Gráfica.</td>
 
     </tr>
 
     </tr>
 
</table>
 
</table>
  
=GeoGebraApplet para Comunicación JavaScript=
+
=Comunicación JavaScript-GeoGebraApplet=
 +
 
 +
Los siguientes métodos permiten implementar un Applet para la comunicación JavaScript. Al emplearlos, es preciso asegurarse de insertar la opción <span class="term"><span class="highlightedSearchTerm"><span style="font-weight: bold;">MAYSCRIPT</span> añadida al final de la primera línea de la etiqueta del ''applet'' en curso (applet tag). Por ejemplo:
 +
<span style="font-family: monospace;">&lt;applet name="ggbApplet" code="geogebra.GeoGebraApplet" codebase="." archive="geogebra.jar" width="500" height="250" </span><span style="font-weight: bold; font-family: monospace; color: rgb(255, 0, 0);">MAYSCRIPT</span><span style="font-family: monospace;">&gt;</span>.
 +
La opción <span class="highlightedSearchTerm">MAYSCRIPT</span>  <span class="highlightedSearchTerm">se</span> precisa únicamente para comunicación GeoGebraApplet a JavaScript; no es <span class="highlightedSearchTerm"> </span> necesaria para el acceso de JavaScript a los métodos de GeoGebraApplet. <!--
 +
Por ejemplo, estos métodos pueden emplearse para:
 +
* acciones de empleo del monitor {{Note|1= Ver [http://www.geogebra.org/source/program/applet/geogebra_applet_java2javascript.htm java2javascript example].}}
 +
* comunicaciones entre dos applets GeoGebra  {{Note|1= Ver [http://www.geogebra.org/source/program/applet/geogebra_applet_java2java.htm java2java example].}}
 +
-->
 +
<table style="width: 100%;" class="pretty">
 +
    <tr>
 +
      <th>De</th>
 +
      <th style="text-align: center;"><u>Firma del Método</u>: <br>void registerAddListener(String JSFunctionName)</th>
 +
    </tr>
 +
    <tr>
 +
 
 +
<table style="width: 100%;" class="pretty">
 +
{| class="pretty"<!--
 +
|De||<u>Firma del Método</u>: <br>void registerAddListener(String JSFunctionName) -->
 +
|-
 +
|3.0||Registra una función JavaScript como un <span style="font-weight: bold;">detector añadido </span> a la construcción del applet. Cuando un objeto se crea en la construcción de GeoGebraApplet, se ''llama'' a la función de JavaScript  <span style="font-style: italic;">JSFunctionName</span> usando el nombre del objeto recién creado como su único argumento.<br>
 +
<span style="font-style: italic;">Ejemplo</span>: Primero, registra una función de detección de  JavaScript:<br>
 +
<div style="margin-left: 40px;"><span style="font-family: monospace;">ggbApplet.registerAddListener( "myAddListenerFunction" );</span> <br>
 +
</div>
 +
Cuando se crea un objeto "A", el applet de GeoGebra llama a la función JavaScript<br>
 +
<div style="margin-left: 40px;"><span style="font-family: monospace;">myAddListenerFunction(" </span><span style="font-family: monospace; ">A");<br>
 +
</span></div>
 +
|-
 +
<table style="width: 100%;" class="pretty">
 +
    <tr>
 +
      <th>De</th>
 +
      <th style="text-align: center;"><u>Firma del Método</u>: <br>void unregisterRemoveListener(String objName)</th>
 +
    </tr>
 +
    <tr>
 +
<table style="width: 100%;" class="pretty">
 +
{| class="pretty"<!--
 +
|De||<u>Firma del Método</u>: void unregisterRemoveListener(String objName)-->
 +
|-
 +
|3.0||Elimina un '' detector añadido '' previamente registrado, ver <span style="font-style: italic;">registerAddListener()</span>
 +
|-
 +
<table style="width: 100%;" class="pretty">
 +
    <tr>
 +
      <th>De</th>
 +
      <th style="text-align: center;"><u>Firma del Método</u>: <br>void registerRemoveListener(String JSFunctionName</th>
 +
    </tr>
 +
    <tr>
 +
<table style="width: 100%;" class="pretty">
 +
{| class="pretty"<!--
 +
|De||<u>Firma del Método</u>:  void registerRemoveListener(String JSFunctionName)-->
 +
|-
 +
|3.0||Registra una función de detección de JavaScript como detector de  <span style="font-weight: bold;">eliminación</span> para la construcción de applet. Siempre que un objeto es eliminado en la construcción activa en el GeoGebraApplet, se llama a la función de JavaScript <span style="font-style: italic;">JSFunctionName</span> utilizando como único argumento el nombre del objeto eliminado. Atención:  Cuando se cancela toda la construcción, ''remove'' no es llamado por un objeto individual: ver registerClearListener().<br>
 +
<span style="font-style: italic;">Ejemplo</span>: Registrar una función de detector por encima de una función JavaScript:<br>
 +
<div style="margin-left: 40px;"><span style="font-family: monospace;">ggbApplet.registerRemoveListener(" myRemoveListenerFunction ");</span> </div>
 +
Cuando un objeto "A" se elimina, el applet de GeoGebra llama a la función JavaScript<br>
 +
<div style="margin-left: 40px;"><span style="font-family: monospace;">myRemoveListenerFunction</span><span style=" font-family: monospace; ">("</span><span style="font-family: monospace;">A");<br>
 +
</span></div>
 +
|-
 +
<table style="width: 100%;" class="pretty">
 +
    <tr>
 +
      <th>De</th>
 +
      <th style="text-align: center;"><u>Firma del Método</u>: <br>void unregisterRemoveListener(String objName)</th>
 +
    </tr>
 +
    <tr>
 +
<table style="width: 100%;" class="pretty">
 +
{| class="pretty"<!--
 +
|De||<u>Firma del Método</u>: void unregisterRemoveListener(String objName)-->
 +
|-
 +
|3.0||Elimina un detector previamente registrado, ver  <span style=" font-style: italic; ">registerRemoveListener()</span>
 +
|-
 +
<table style="width: 100%;" class="pretty">
 +
    <tr>
 +
      <th>De</th>
 +
      <th style="text-align: center;"><u>Firma del Método</u>: <br>void registerUpdateListener(String JSFunctionName)</th>
 +
    </tr>
 +
    <tr>
 +
<table style="width: 100%;" class="pretty">
 +
{| class="pretty"<!--
 +
|De||<u>Firma del Método</u>: void registerUpdateListener(String JSFunctionName)-->
 +
|-
 +
|3.0||Registra una función JavaScript como detector <span style="font-weight: bold;">de actualización</span> para la construcción del applet. Cuando un objeto es actualizado en la construcción activa en GeoGebraApplet, es llamada una función JavaScript <span style="font-style: italic;">JSFunctionName</span> utilizando como único  argumento el nombre del objeto actualizado.Atención: Si se detector exclusivamente vinculado a la actualización de un  determinado objeto, es mejor emplear registerObjectUpdateListener() .<br>
 +
<span style="font-style: italic;">Ejemplo</span>: Registrare innanzitutto una funzione listener JavaScript:<br>
 +
<div style="margin-left: 40px;"><span style="font-family: monospace;">ggbApplet.registerUpdateListener(" myUpdateListenerFunction ");</span> </div>
 +
Cuando un objeto "A" se actualiza, el applet de GeoGebra llama a la función Javascript<br>
 +
<div style="margin-left: 40px;"><span style="font-family: monospace;">myUpdateListenerFunction</span><span style=" font-family: monospace; ">("</span><span style="font-family: monospace;">A");<br>
 +
</span></div>
 +
|-
 +
 
 +
<table style="width: 100%;" class="pretty">
 +
    <tr>
 +
      <th>De</th>
 +
      <th style="text-align: center;"><u>Firma del Método</u>: <br>void unregisterUpdateListener(String objName)</th>
 +
    </tr>
 +
    <tr>
 +
<table style="width: 100%;" class="pretty">
 +
{| class="pretty"<!--
 +
|De||<u>Firma del Método</u>: void unregisterUpdateListener(String objName)-->
 +
|-
 +
|3.0||Elimina un detector previamente registrado, ver  <span style=" font-style: italic; ">registerRemoveListener()</span>
 +
|-
 +
<table style="width: 100%;" class="pretty">
 +
    <tr>
 +
      <th>De</th>
 +
      <th style="text-align: center;"><u>Firma del Método</u>: <br>void registerObjectUpdateListener(String objName, String JSFunctionName)</th>
 +
    </tr>
 +
    <tr>
 +
<table style="width: 100%;" class="pretty">
 +
{| class="pretty"<!--
 +
|De||<u>Firma del Método</u>: void registerObjectUpdateListener(String objName, String JSFunctionName)-->
 +
|-
 +
|3.0||Registra una función JavaScript como detector de  <span style="font-weight: bold;">actualización</span> para un objeto individual. Cuando el objeto con el nombre dado se actualiza, la función JavaScript <span style="font-style: italic;">JSFunctionName</span> es llamada usando el nombre del objeto actualizado como su único argumento. Si objName tenía previamente una función JavaScript mapeada, el valor previo es reemplazado. Atención: todos los detectores de actualización de objeto quedan no registrados cuando sus objetos se eliminan de la construcción o la construcción se borra, ver registerRemoveListener() and registerClearListener().<br>
 +
<span style="font-style: italic;">Ejemplo</span>: Primero, registrar una función de detección de  JavaScript:<br>
 +
<div style="margin-left: 40px;"><span style="font-family: monospace;">ggbApplet.registerObjectUpdateListener("A", "</span><span style=" font-family: monospace; ">myAupdateListenerFunction</span><span style="font-family: monospace;">");</span> <br>
 +
</div>
 +
Cuando el objeto ''A'' se actualiza, el Applet GeoGebra llamará a la función Javascript <br>
 +
<div style="margin-left: 40px;"><span style="font-family: monospace;"></span><span style="font-family: monospace;">myAupdateListenerFunction</span><span style="font-family: monospace;"></span><span style="font-family: monospace;">("A");<br>
 +
</span></div>
 +
Atención: un detector de actualización de objeto operará aún después de haber sido renombrado el objeto.<span style="font-family: monospace;"></span>
 +
|-
 +
<table style="width: 100%;" class="pretty">
 +
    <tr>
 +
      <th>De</th>
 +
      <th style="text-align: center;"><u>Firma del Método</u>: <br>void unregisterObjectUpdateListener(String objName)</th>
 +
    </tr>
 +
    <tr>
 +
<table style="width: 100%;" class="pretty">
 +
{| class="pretty"<!--
 +
|De||<u>Firma del Método</u>: void unregisterObjectUpdateListener(String objName)-->
 +
|-
 +
|3.0||Elimina un detector de actualización de objeto (con el nombre dado), previamente registrado, ver <span style="font-style: italic;">registerObjectUpdateListener()</span>
 +
|-
  
With these methods you can implement Applet to JavaScript communication. When you use any of the following methods, you should make sure to insert the <span class="term"><span class="highlightedSearchTerm"><span style="font-weight: bold;">MAYSCRIPT</span> option add the end of the first line of your applet tag. For example:
+
<table style="width: 100%;" class="pretty">
 +
    <tr>
 +
      <th>De</th>
 +
      <th style="text-align: center;"><u>Firma del Método</u>: <br>void registerRenameListener(String JSFunctionName)</th>
 +
    </tr>
 +
    <tr>
 +
<table style="width: 100%;" class="pretty">
 +
{| class="pretty"<!--
 +
|De||<u>Firma del Método</u>: void registerRenameListener(String JSFunctionName)-->
 +
|-
 +
|3.0||Registra una función JavaScript como detector de  <span style="font-weight: bold;">cambio de nombre</span> para el applet de la construcción. Cuando a un objeto se le cambia el nombre en la construcción del GeoGebraApplet, la función JavaScript  <span style="font-style: italic;">JSFunctionName</span> es llamada usando el viejo nombre y el nuevo del objeto rebautizado como sendos argumentos. <br>
 +
<span style="font-style: italic;">Ejemplo</span>: Primero, registrar una función de detección de JavaScript:<br>
 +
<div style="margin-left: 40px;"><span style=" font-family: monospace; ">ggbApplet.registerRenameListener("myRenameListenerFunction");</span> </div>
 +
Cuando a un  objeto "A" se la cambia el nombre por "B", el Applet GeoGebra llamará a la función de Javascript<br>
 +
<div style="margin-left: 40px;"><span style="font-family: monospace;">myRenameListenerFunction</span><span style=" font-family: monospace; ">("</span><span style="font-family: monospace;">A", "B");<br>
 +
</span></div>
 +
|-
  
<span style="font-family: monospace;">&lt;applet name="ggbApplet" code="geogebra.GeoGebraApplet" codebase="." archive="geogebra.jar" width="500" height="250" </span><span style="font-weight: bold; font-family: monospace; color: rgb(255, 0, 0);">MAYSCRIPT</span><span style="font-family: monospace;">&gt;</span>.
+
<table style="width: 100%;" class="pretty">
The <span class="highlightedSearchTerm">MAYSCRIPT</span> option <span class="highlightedSearchTerm">is</span> only needed for GeoGebraApplet to JavaScript communication; it <span class="highlightedSearchTerm">is</span> not needed for JavaScript to access the GeoGebraApplet methods.
+
    <tr>
For example, these methods can be used to:
+
      <th>De</th>
* monitor user actions (see [http://www.geogebra.org/source/program/applet/geogebra_applet_java2javascript.htm java2javascript example])
+
      <th style="text-align: center;"><u>Firma del Método</u>: <br>void unregisterRenameListener(String objName)</th>
* communicate between two GeoGebra applets (see [http://www.geogebra.org/source/program/applet/geogebra_applet_java2java.htm java2java example])
+
    </tr>
 +
    <tr>
 +
<table style="width: 100%;" class="pretty">
 +
{| class="pretty"<!--
 +
|De||<u>Firma del Método</u>:  void unregisterRenameListener(String objName)-->
 +
|-
 +
|3.0||Elimina un detector de cambio de nombre de objeto previamente registrado, ver  <span style="font-style: italic;">registerRenameListener()</span>
 +
|-
 +
 
 +
<table style="width: 100%;" class="pretty">
 +
    <tr>
 +
      <th>De</th>
 +
      <th style="text-align: center;"><u>Firma del Método</u>: <br>void registerClearListener(String JSFunctionName)</th>
 +
    </tr>
 +
    <tr>
 
<table style="width: 100%;" class="pretty">
 
<table style="width: 100%;" class="pretty">
 +
{| class="pretty"<!--
 +
|De||<u>Firma del Método</u>: void registerClearListener(String JSFunctionName) -->
 +
|-
 +
|3.0||Registra una función JavaScript como detector de  <span style="font-weight: bold;">borrado</span> para el applet de la construcción. Cuando la construcción de la GeoGebraApplet se borra (por ejemplo, todos los objetos son eliminados), la función JavaScript f JSFunctionName es llamada sin argumentos. Atención: todos los detectores de actualización quedan sin registro cuando una construcción es borrada. Ver registerUpdateListener() yregisterRemoveListener().<br>
 +
<span style="font-style: italic;">Ejemplo</span>: Primero, registrar una función de detección de  JavaScript<br>
 +
<div style="margin-left: 40px;"><span style="font-family: monospace;">ggbApplet.registerClearListener("myClearListenerFunction");</span> </div>
 +
Cuando la construcción se borra (por ejemplo. después de reajustar una construcción o abrir a un nuevo archivo de construcción), el Applet GeoGebra llamará a la función Javascript<br>
 +
<div style="margin-left: 40px;"><span style="font-family: monospace;">myClearListenerFunction</span><span style="font-family: monospace;">(</span><span style="font-family: monospace;">);</span></div>
 +
|-
 +
|}
 +
</table>
 +
<!--
 +
{| class="pretty"
 +
<table style="width: 10%;" class="pretty">
 
  <tr>
 
  <tr>
  <th>Method Signature</th>
+
  <th>Firma del Método</th>
  <th style="text-align: center;">Since</th>
+
  <th style="text-align: center;"><small>Desde</small></th>
  <th style="font-weight: bold;">Description</th>
+
  <th style="font-weight: bold;">Descripción</th>
 
  </tr>
 
  </tr>
 
  <tr>
 
  <tr>
  <td>void registerAddListener(String JSFunctionName)</td>
+
  <td><small>void registerAddListener(String JSFunctionName)</small></td>
 
  <td style="text-align: center;">3.0</td>
 
  <td style="text-align: center;">3.0</td>
<td>Registers a JavaScript function as an <span style="font-weight: bold;">add</span> listener for the applet's construction. Whenever a new object is created in the GeoGebraApplet's construction, the JavaScript function <span style="font-style: italic;">JSFunctionName</span> is called using the name of the newly created object as its single argument. <br>
+
 
<span style="font-style: italic;">Example</span>: First, register a listening JavaScript function:<br>
+
<td>Registra una función JavaScript como un <span style="font-weight: bold;">detector añadido </span> a la construcción del applet. Cuando un objeto se crea en la construcción de GeoGebraApplet, se ''llama'' a la función de JavaScript <span style="font-style: italic;">JSFunctionName</span> usando el nombre del objeto recién creado como su único argumento.<br>
<div style="margin-left: 40px;"><span style="font-family: monospace;">ggbApplet.registerAddListener("myAddListenerFunction");</span> <br>
+
<span style="font-style: italic;">Ejemplo</span>: Primero, registra una función de detección de  JavaScript:<br>
 +
<div style="margin-left: 40px;"><span style="font-family: monospace;">ggbApplet.registerAddListener( "myAddListenerFunction" );</span> <br>
 
  </div>
 
  </div>
When an object "A" is created, the GeoGebra Applet will call the Javascript function<br>
+
Cuando se crea un objeto "A", el applet de GeoGebra llama a la función JavaScript<br>
  <div style="margin-left: 40px;"><span style="font-family: monospace;">myAddListenerFunction("</span><span style="font-family: monospace;">A");<br>
+
  <div style="margin-left: 40px;"><span style="font-family: monospace;">myAddListenerFunction(" </span><span style="font-family: monospace; ">A");<br>
 
  </span></div>
 
  </span></div>
 
  </td>
 
  </td>
 
  </tr>
 
  </tr>
 
  <tr>
 
  <tr>
  <td>void unregisterAddListener(String objName)</td>
+
  <td><small>void unregisterAddListener(String objName)</small></td>
 
  <td style="text-align: center;">3.0</td>
 
  <td style="text-align: center;">3.0</td>
  <td>Removes a previously registered add listener, see <span style="font-style: italic;">registerAddListener()</span></td>
+
  <td>Elimina un '' detector añadido '' previamente registrado, ver <span style="font-style: italic;">registerAddListener()</span></td>
 
  </tr>
 
  </tr>
 
  <tr>
 
  <tr>
  <td>void registerRemoveListener(String JSFunctionName)</td>
+
  <td><small>void registerRemoveListener(String JSFunctionName)</small></td>
 
  <td style="text-align: center;">3.0</td>
 
  <td style="text-align: center;">3.0</td>
  <td>Registers a JavaScript function as a <span style="font-weight: bold;">remove</span> listener for the applet's construction. Whenever an object is deleted from the GeoGebraApplet's construction, the JavaScript function <span style="font-style: italic;">JSFunctionName</span> is called using the name of the deleted object as its single argument. Note: when a construction is cleared, remove is not called for every single object, see registerClearListener().<br>
+
  <td>Registra una función de detección de JavaScript como detector de  <span style="font-weight: bold;">eliminación</span> para la construcción de applet. Siempre que un objeto es eliminado en la construcción activa en el GeoGebraApplet, se llama a la función de JavaScript <span style="font-style: italic;">JSFunctionName</span> utilizando como único argumento el nombre del objeto eliminado. Atención: Cuando se cancela toda la construcción, ''remove'' no es llamado por un objeto individual: ver registerClearListener().<br>
<span style="font-style: italic;">Example</span>: First, register a listening JavaScript function:<br>
+
<span style="font-style: italic;">Ejemplo</span>: Registrar una función de detector por encima de una función JavaScript:<br>
<div style="margin-left: 40px;"><span style="font-family: monospace;">ggbApplet.registerRemoveListener("myRemoveListenerFunction");</span> </div>
+
<div style="margin-left: 40px;"><span style="font-family: monospace;">ggbApplet.registerRemoveListener(" myRemoveListenerFunction ");</span> </div>
When the object "A" is deleted, the GeoGebra Applet will call the Javascript function<br>
+
Cuando un objeto "A" se elimina, el applet de GeoGebra llama a la función JavaScript<br>
  <div style="margin-left: 40px;"><span style="font-family: monospace;">myRemoveListenerFunction</span><span style="font-family: monospace;">("</span><span style="font-family: monospace;">A");<br>
+
  <div style="margin-left: 40px;"><span style="font-family: monospace;">myRemoveListenerFunction</span><span style=" font-family: monospace; ">("</span><span style="font-family: monospace;">A");<br>
 
  </span></div>
 
  </span></div>
 
  </td>
 
  </td>
 
  </tr>
 
  </tr>
 
  <tr>
 
  <tr>
  <td>void unregisterRemoveListener(String objName)</td>
+
  <td><small>void unregisterRemoveListener(String objName)</small></td>
  <td style="text-align: center;">3.0</td>
+
  <td style=" text-align: center; ">3.0</td>
  <td>Removes a previously registered remove listener, see <span style="font-style: italic;">registerRemoveListener()</span></td>
+
  <td>Elimina un detector previamente registrado, ver  <span style=" font-style: italic; ">registerRemoveListener()</span></td>
 
  </tr>
 
  </tr>
 
  <tr>
 
  <tr>
  <td>void registerUpdateListener(String JSFunctionName)</td>
+
  <td><small>void registerUpdateListener(String JSFunctionName)</small></td>
 
  <td style="text-align: center;">3.0</td>
 
  <td style="text-align: center;">3.0</td>
  <td>Registers a JavaScript function as a <span style="font-weight: bold;">update</span> listener for the applet's construction. Whenever any object is updated in the GeoGebraApplet's construction, the JavaScript function <span style="font-style: italic;">JSFunctionName</span>is called using the name of the updated object as its single argument. Note: when you only want to listen for the updates of a single object use registerObjectUpdateListener() instead.<br>
+
  <td>Registra una función JavaScript como detector <span style="font-weight: bold;">de actualización</span> para la construcción del applet. Cuando un objeto es actualizado en la construcción activa en GeoGebraApplet, es llamada una función JavaScript <span style="font-style: italic;">JSFunctionName</span> utilizando como único  argumento el nombre del objeto actualizado.Atención: Si se detector exclusivamente vinculado a la actualización de un  determinado objeto, es mejor emplear registerObjectUpdateListener() .<br>
<span style="font-style: italic;">Example</span>: First, register a listening JavaScript function:<br>
+
<span style="font-style: italic;">Ejemplo</span>: Registrare innanzitutto una funzione listener JavaScript:<br>
<div style="margin-left: 40px;"><span style="font-family: monospace;">ggbApplet.registerUpdateListener("myUpdateListenerFunction");</span> </div>
+
<div style="margin-left: 40px;"><span style="font-family: monospace;">ggbApplet.registerUpdateListener(" myUpdateListenerFunction ");</span> </div>
When the object "A" is updated, the GeoGebra Applet will call the Javascript function<br>
+
Cuando un objeto "A" se actualiza, el applet de GeoGebra llama a la función Javascript<br>
  <div style="margin-left: 40px;"><span style="font-family: monospace;">myUpdateListenerFunction</span><span style="font-family: monospace;">("</span><span style="font-family: monospace;">A");<br>
+
  <div style="margin-left: 40px;"><span style="font-family: monospace;">myUpdateListenerFunction</span><span style=" font-family: monospace; ">("</span><span style="font-family: monospace;">A");<br>
 
  </span></div>
 
  </span></div>
 
  </td>
 
  </td>
 
  </tr>
 
  </tr>
 
  <tr>
 
  <tr>
  <td>void unregisterUpdateListener(String objName)</td>
+
  <td><small>void unregisterUpdateListener(String objName)</small></td>
 
  <td style="text-align: center;">3.0</td>
 
  <td style="text-align: center;">3.0</td>
  <td>Removes a previously registered update listener, see <span style="font-style: italic;">registerUpdateListener()</span></td>
+
  <td>Elimina un detector de actualización previamente registrado, ver <span style="font-style: italic;">registerUpdateListener()</span></td>
 
  </tr>
 
  </tr>
 
  <tr>
 
  <tr>
  <td>void registerObjectUpdateListener(String objName, String JSFunctionName)</td>
+
  <td><small>void registerObjectUpdateListener(String objName, String JSFunctionName)</small></td>
 
  <td style="text-align: center;">3.0</td>
 
  <td style="text-align: center;">3.0</td>
  <td>Registers a JavaScript function as an <span style="font-weight: bold;">update</span> listener for a single object. Whenever the object with the given name is updated, the JavaScript function <span style="font-style: italic;">JSFunctionName</span>is called using the name of the updated object as its single argument. If objName previously had a mapping JavaScript function, the old value is replaced. Note: all object updated listeners are unregistered when their object is removed or the construction is cleared, see registerRemoveListener() and registerClearListener().<br>
+
  <td>Registra una función JavaScript como detector de  <span style="font-weight: bold;">actualización</span> para un objeto individual. Cuando el objeto con el nombre dado se actualiza, la función JavaScript <span style="font-style: italic;">JSFunctionName</span> es llamada usando el nombre del objeto actualizado como su único argumento. Si objName tenía previamente una función JavaScript mapeada, el valor previo es reemplazado. Atención: todos los detectores de actualización de objeto quedan no registrados cuando sus objetos se eliminan de la construcción o la construcción se borra, ver registerRemoveListener() and registerClearListener().<br>
<span style="font-style: italic;">Example</span>: First, register a listening JavaScript function:<br>
+
<span style="font-style: italic;">Ejemplo</span>: Primero, registrar una función de detección de  JavaScript:<br>
<div style="margin-left: 40px;"><span style="font-family: monospace;">ggbApplet.registerObjectUpdateListener("A", "</span><span style="font-family: monospace;">myAupdateListenerFunction</span><span style="font-family: monospace;">");</span> <br>
+
<div style="margin-left: 40px;"><span style="font-family: monospace;">ggbApplet.registerObjectUpdateListener("A", "</span><span style=" font-family: monospace; ">myAupdateListenerFunction</span><span style="font-family: monospace;">");</span> <br>
 
  </div>
 
  </div>
Whenever the object A is updated, the GeoGebra Applet will call the Javascript function<br>
+
Cuando el objeto ''A'' se actualiza, el Applet GeoGebra llamará a la función Javascript <br>
 
  <div style="margin-left: 40px;"><span style="font-family: monospace;"></span><span style="font-family: monospace;">myAupdateListenerFunction</span><span style="font-family: monospace;"></span><span style="font-family: monospace;">("A");<br>
 
  <div style="margin-left: 40px;"><span style="font-family: monospace;"></span><span style="font-family: monospace;">myAupdateListenerFunction</span><span style="font-family: monospace;"></span><span style="font-family: monospace;">("A");<br>
 
  </span></div>
 
  </span></div>
Note: an object update listener will still work after an object is renamed.<span style="font-family: monospace;"></span>
+
Atención: un detector de actualización de objeto operará aún después de haber sido renombrado el objeto.<span style="font-family: monospace;"></span>
 
</td>
 
</td>
 
</tr>
 
</tr>
 
<tr>
 
<tr>
  <td>void unregisterObjectUpdateListener(String objName)</td>
+
  <td><small>void unregisterObjectUpdateListener(String objName)</small></td>
 
  <td style="text-align: center;">3.0</td>
 
  <td style="text-align: center;">3.0</td>
  <td>Removes a previously registered object update listener of the object with the given name, see <span style="font-style: italic;">registerObjectUpdateListener()</span></td>
+
  <td>Elimina un detector de actualización de objeto (con el nombre dado), previamente registrado, ver <span style="font-style: italic;">registerObjectUpdateListener()</span></td>
 
  </tr>
 
  </tr>
 
  <tr>
 
  <tr>
  <td>void registerRenameListener(String JSFunctionName)</td>
+
  <td><small>void registerRenameListener(String JSFunctionName)</small></td>
 
  <td style="text-align: center;">3.0</td>
 
  <td style="text-align: center;">3.0</td>
  <td>Registers a JavaScript function as a <span style="font-weight: bold;">rename</span> listener for the applet's construction. Whenever an object is renamed in the GeoGebraApplet's construction, the JavaScript function <span style="font-style: italic;">JSFunctionName</span> is called using the old name and the new name of the renamed object as its two arguments. <br>
+
  <td>Registra una función JavaScript como detector de  <span style="font-weight: bold;">cambio de nombre</span> para el applet de la construcción. Cuando a un objeto se le cambia el nombre en la construcción del GeoGebraApplet, la función JavaScript <span style="font-style: italic;">JSFunctionName</span> es llamada usando el viejo nombre y el nuevo del objeto rebautizado como sendos argumentos. <br>
<span style="font-style: italic;">Example</span>: First, register a listening JavaScript function:<br>
+
<span style="font-style: italic;">Ejemplo</span>: Primero, registrar una función de detección de JavaScript:<br>
<div style="margin-left: 40px;"><span style="font-family: monospace;">ggbApplet.registerRenameListener("myRenameListenerFunction");</span> </div>
+
<div style="margin-left: 40px;"><span style=" font-family: monospace; ">ggbApplet.registerRenameListener("myRenameListenerFunction");</span> </div>
When an object "A" is renamed to "B", the GeoGebra Applet will call the Javascript function<br>
+
Cuando a un  objeto "A" se la cambia el nombre por "B", el Applet GeoGebra llamará a la función de Javascript<br>
  <div style="margin-left: 40px;"><span style="font-family: monospace;">myRenameListenerFunction</span><span style="font-family: monospace;">("</span><span style="font-family: monospace;">A", "B");<br>
+
  <div style="margin-left: 40px;"><span style="font-family: monospace;">myRenameListenerFunction</span><span style=" font-family: monospace; ">("</span><span style="font-family: monospace;">A", "B");<br>
 
  </span></div>
 
  </span></div>
 
  </td>
 
  </td>
 
  </tr>
 
  </tr>
 
  <tr>
 
  <tr>
  <td>void unregisterRenameListener(String objName)</td>
+
  <td><small>void unregisterRenameListener(String objName)</small></td>
 
  <td style="text-align: center;">3.0</td>
 
  <td style="text-align: center;">3.0</td>
  <td>Removes a previously registered rename listener, see <span style="font-style: italic;">registerRenameListener()</span></td>
+
  <td>Elimina un detector de cambio de nombre de objeto previamente registrado, ver  <span style="font-style: italic;">registerRenameListener()</span></td>
 
  </tr>
 
  </tr>
 
  <tr>
 
  <tr>
  <td>void registerClearListener(String JSFunctionName)</td>
+
  <td><small>void registerClearListener(String JSFunctionName)</small></td>
 
  <td style="text-align: center;">3.0</td>
 
  <td style="text-align: center;">3.0</td>
  <td>Registers a JavaScript function as a <span style="font-weight: bold;">clear</span> listener for the applet's construction. Whenever the construction in the GeoGebraApplet is cleared (i.e. all objects are removed), the JavaScript function JSFunctionName is called using no arguments. Note: all update listeners are unregistered when a construction is cleared. See registerUpdateListener() and registerRemoveListener().<br>
+
  <td>Registra una función JavaScript como detector de  <span style="font-weight: bold;">borrado</span> para el applet de la construcción. Cuando la construcción de la GeoGebraApplet se borra (por ejemplo, todos los objetos son eliminados), la función JavaScript f JSFunctionName es llamada sin argumentos. Atención: todos los detectores de actualización quedan sin registro cuando una construcción es borrada. Ver registerUpdateListener() yregisterRemoveListener().<br>
<span style="font-style: italic;">Example</span>: First, register a listening JavaScript function:<br>
+
<span style="font-style: italic;">Ejemplo</span>: Primero, registrar una función de detección de  JavaScript<br>
 
<div style="margin-left: 40px;"><span style="font-family: monospace;">ggbApplet.registerClearListener("myClearListenerFunction");</span> </div>
 
<div style="margin-left: 40px;"><span style="font-family: monospace;">ggbApplet.registerClearListener("myClearListenerFunction");</span> </div>
When the construction is cleared (i.e. after reseting a construction or opening a new construction file), the GeoGebra Applet will call the Javascript function<br>
+
Cuando la construcción se borra (por ejemplo. después de reajustar una construcción o abrir a un nuevo archivo de construcción), el Applet GeoGebra llamará a la función Javascript<br>
 
  <div style="margin-left: 40px;"><span style="font-family: monospace;">myClearListenerFunction</span><span style="font-family: monospace;">(</span><span style="font-family: monospace;">);</span></div>
 
  <div style="margin-left: 40px;"><span style="font-family: monospace;">myClearListenerFunction</span><span style="font-family: monospace;">(</span><span style="font-family: monospace;">);</span></div>
 
  </td>
 
  </td>
 
  </tr>
 
  </tr>
 
  <tr>
 
  <tr>
  <td>void unregisterClearListener(String JSFunctionName)</td>
+
  <td><small>void unregisterClearListener(String JSFunctionName)</small></td>
 
  <td style="text-align: center;">3.0</td>
 
  <td style="text-align: center;">3.0</td>
  <td>Removes a previously registered clear listener, see <span style="font-style: italic;">registerClearListener()</span></td>
+
  <td>Elimina un detector de borrado previamente registrado, ver <span style=" font-style: italic; ">registerClearListener()</span></td>
 
  </tr>
 
  </tr>
 
</table>
 
</table>
 +
-->
  
= Formato XML de GeoGebra =
+
=Formato XML de GeoGebra =
  
Con estos métodos se puede establecer prácticamente todo en una construcción (ver [[Referencia:Xml|Referencia XML]] ).
+
Con estos métodos se puede establecer prácticamente todo en una construcción (ver [[Referencia:XML|Referencia XML]] ).
 
<table style="width: 100%;" class="pretty">
 
<table style="width: 100%;" class="pretty">
 
     <tr>
 
     <tr>
       <th>Method Signature</th>
+
       <th>Firma del Método</th>
       <th style="text-align: center;">Since</th>
+
       <th style="text-align: center;">Desde</th>
       <th>Description</th>
+
       <th>Descripción</th>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>void evalXML(String xmlString) </td>
 
       <td>void evalXML(String xmlString) </td>
 
       <td style="text-align: center;">2.7</td>
 
       <td style="text-align: center;">2.7</td>
       <td>Evaluates the given XML string and changes the current construction. Note: the construction is NOT cleared before evaluating the XML string.
+
       <td>Evalúa la cadena XML dada y cambia la construcción activa. Atención: la construcción no es borrada antes de la evaluación de la cadena XML.
 
       </td>
 
       </td>
 
     </tr>
 
     </tr>
Línea 557: Línea 752:
 
       <td>void setXML(String xmlString) </td>
 
       <td>void setXML(String xmlString) </td>
 
       <td style="text-align: center;">2.7</td>
 
       <td style="text-align: center;">2.7</td>
       <td>Evaluates the given XML string and changes the current construction. Note: the construction is cleared before evaluating the XML string. This method could be used to load constructions.
+
       <td>Evalúa la cadena XML dada y cambia la construcción activa. Atención: la construcción es borrada antes de la evaluación de la cadena XML. Este método puede emplearse para cargar construcciones.
 
       </td>
 
       </td>
 
     </tr>
 
     </tr>
Línea 564: Línea 759:
 
       </td>
 
       </td>
 
       <td style="text-align: center;">2.7</td>
 
       <td style="text-align: center;">2.7</td>
       <td>Returns the current construction in GeoGebra's XML format. This method could be used to save constructions.<br>
+
       <td>Da por resultado la construcción activa en formato XML de GeoGebra. Este método puede emplearse para guardar construcciones.<br>
 
       </td>
 
       </td>
 
     </tr>
 
     </tr>
Línea 571: Línea 766:
 
       </td>
 
       </td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td>Returns the GeoGebra XML string for the given object, i.e. only the &lt;element&gt; tag is returned.
+
       <td>Da por resultado la cadena XML de GeoGebra para el objeto dado, por ejemplo, solo la etiqueta o ''tag'' del &lt;elemento&gt; deviene resultado.
 
       </td>
 
       </td>
 
     </tr>
 
     </tr>
Línea 578: Línea 773:
 
       </td>
 
       </td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td>For a dependent GeoElement objName the XML string of the parent algorithm and all its output objects is returned. For a free GeoElement objName "" is returned.  
+
       <td>Para un GeoElemento objName dependiente, deviene resultado la cadena XML del algoritmo precedente y todos sus objetos de salida. Para un GeoElemento objName libre, la salida resultante es "".  
 
       </td>
 
       </td>
 
     </tr>
 
     </tr>
 
</table>
 
</table>
  
= Misceláneas =
+
=Misceláneas=
 
 
  
 
<table style="width: 100%;" class="pretty">
 
<table style="width: 100%;" class="pretty">
 
     <tr>
 
     <tr>
       <th>Method Signature</th>
+
       <th>Firma del Método</th>
       <th>Since</th>
+
       <th>Desde</th>
       <th>Description</th>
+
       <th>Descripción</th>
 
     </tr>
 
     </tr>
 
     <tr>
 
     <tr>
 
       <td>String evalMathPiper(String string) </td>
 
       <td>String evalMathPiper(String string) </td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td>Passes the string to MathPiper and returns the result as a String.<br>
+
       <td>Pasa la cadena a MathPiper y establece el resultado como una Cadena.<br>
<b>Removed in GeoGebra 4.0 and will replaced with evalGeoGebraCAS() in GeoGebra 4.2</b>
+
<b>Eliminado en GeoGebra 4.0 y será reemplazado con evalGeoGebraCAS() wn GeoGebra 4.2</b>
 
       </td>
 
       </td>
 
     </tr>
 
     </tr>
Línea 602: Línea 796:
 
       <td>String getIPAddress()</td>
 
       <td>String getIPAddress()</td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td>Returns the IP address of the local computer as a String eg "192.168.0.4"
+
       <td>Da por resultado la dirección de IP de la computadora local como una Cadena; por ejemplo, "192.168.0.4"
 
       </td>
 
       </td>
 
     </tr>
 
     </tr>
Línea 608: Línea 802:
 
       <td>String getHostname() </td>
 
       <td>String getHostname() </td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td>Returns the hostname of the local computer as a String
+
       <td>Da por resultado el nombre del ''host'' de la computadora local como una Cadena
 
       </td>
 
       </td>
 
     </tr>
 
     </tr>
Línea 614: Línea 808:
 
       <td>void debug(String string) </td>
 
       <td>void debug(String string) </td>
 
       <td style="text-align: center;">3.2</td>
 
       <td style="text-align: center;">3.2</td>
       <td>Prints the string to the Java Console
+
       <td>Imprime la cadena de la Consola Java
 
       </td>
 
       </td>
 
     </tr>
 
     </tr>
  
 
</table>
 
</table>
 +
 +
<h2>Obtención del Objeto Applet</h2>
 +
En los casos básicos el ''applet'' está en la variable global ggbApplet.<br> Se listan, a continuación, las excepciones:<br>
 +
*para aplicaciones múltiples -''applets''- en una página, dado que solo una es aceptable por omisión desde JavaScript.<br>Para acceder, entonces, a múltiples ''applets'', se deberá fijar el parámetro "id" de las aplicaciones particulares, de modo que resulte el nombre de la variable global que representa a tal aplicación plural (''applet'' múltipole)
 +
*exportar desde GeoGebra 4.0 y desde aplicaciones previas es aún accesible en tanto se trate de un document.applets[0] y para incluir otros ''applets'' en la misma página serán respectivamente document.applets[1], document.applets[2], document.applets[3]...
 +
;<hr>
 +
 
[[Categoría:Referencia|JavaScript]]
 
[[Categoría:Referencia|JavaScript]]
[[en:Reference:JavaScript]]
+
__NoTOC__
[[fr:Référence:JavaScript]]
 
[[it:Riferimenti:JavaScript]]
 

Revisión actual del 01:09 28 dic 2019

Alerta Alerta:
Se recomienda dirigirse a la versión en inglés para distinguir actualizaciones aún no reflejadas en otros idiomas.

Este artículo describe cómo se puede interactuar con aplicaciones GeoGebra (applet) vía JavaScript. La aplicación applet GeoGebra está representada por un objeto JavaScript, que en este documento se como almacenado en una variable denominada ggbApplet.
Tal presunción se corrobora si se está empleando JavaScript desde el interior de GeoGebra o si se lo está usando en una página web con una aplicación individual applet de GeoGebra exportada, sea desde GeoGebra directamente (Ctrl + Shift + M) o desde GeoGebra con el enlace del paquete denominado Offline Package.
Los guiones no está disponible para aplicaciones applets exportadas desde GeoGebra vía el dispositivo para incrustar (Embed feature).
En caso de múltiples applets debe consultarse la sección Obtención del Objeto Applet.

Documento Previo

Este documento describe métodos públicos disponibles en geogebra.GeoGebraApplet que pueden emplearse desde una página HTML vía JavaScript.

Ejemplos

Ejemplo 1:
El siguiente fragmento de código HTML añade un botón de reinicio ("Reset") a una página HTML que permite reiniciar la construcción expuesta en el Applet de GeoGebra para que recupere su estado inicial: <form>
<input type="button" value="Réinitialiser" onclick="ggbApplet.reset();">
</form>

Ejemplo 2:
Esto añade dos botones "Oculta A" y "Expone A" cambia el estado de visibilidad de un objeto llamado "A" en la construcción
<form>
<input type="button" value="Cacher A" onclick="ggbApplet.setVisible('A', false);">
<input type="button" value="Afficher A" onclick="ggbApplet.setVisible('A', true);">
</form>

Métodos Disponibles

Firma del Método Desde Descripción
boolean evalCommand(String cmdString) 3.0 Evalúa la cadena dada como cuando se la ingresa desde la Barra de Entrada de GeoGebra. Da por resultado si fue exitosa la evaluación.
A partir de GeoGebra 3.2 se pueden pasar múltiples comandos de a una vez separando cada uno de ellos con \n.
Nota: Usar los nombres de los comandos en inglés para asegurarse su correcta operatoria con todas las versiones de GeoGebra.
La alternativa sería acudir al parámetro del idioma (language) para controlar que operen correctamente los nombres de los comandos.

String evalCommandCAS(Cadena cadena) 3.2 Pasa la cadena al CAS de GeoGebra y da el resultado como una Cadena.
void setUndoPoint() 3.2 Fija un punto de deshace. Útil cuando se quiere que el usuario pueda deshacer lo que la acción de evalCommand, por ejemplo si se ha hecho un botón HTML para actuar como una herramienta de usuario

Con estos métodos se puede implementar comunicaciones Applet a JavaScript. Cuando se los emplea, es preciso asegurarse de haber insertado la opción MAYSCRIPT añadida al final de la primera línea de la etiqueta del applet (applet tag). Por eejmplo:
<applet name="ggbApplet" code="geogebra.GeoGebraApplet" codebase="."
archive="geogebra.jar" width="500" height="250" MAYSCRIPT>
La opción MAYSCRIPT solo se requiere para comunicaciones GeoGebraApplet a JavaScript; no es necesaria para métodos de acceso de JavaScript a GeoGebraApplet.

Fijando Estado de Objetos

Métodos Generales

Firma del Método Desde Descripción
void deleteObject(String objName) 2.7 Elimina el objeto del nombre dado.
void setValue(String objName, double value) 3.2 Fija el doble valor del objeto con el nombre dado. Atención: si el objeto especificado es booleano, se debe usar el valor 1 para establecerlo como verdadero y cualquier otro, para falso. Para cualquier otro tipo de objeto, no se hace nada.
setTextValue(nombre, texto) 5.0 Afecta al texto del objeto de texto referido. No tiene efecto sobre cualquier otro tipo de objeto.
void setListValue(String objName, int i, double value) 5.0 Fija el valor del elemento de la lista en la posición 'i' al valor 'value'
void setCoords(String objName, double x, double y) 3.0 Fija las coordenadas del objeto del nombre dado. Atención: si el objeto especificado no es un punto o un vector, no se hace nada.
void setColor(String objName, int red, int green, int blue) 2.7 Fija el color del objeto con el nombre dado.
void setVisible(String objName, boolean visible) 2.7 Muestra u oculta el objeto con el nombre dado en la vista gráfica.
void setLabelVisible(String objName, boolean visible) 3.0 Muestra u oculta los rótulos del objeto con el nombre dado en la vista gráfica.
void setLabelStyle(String objName, int style) 3.0 Fija el estilo del rótulo del objeto con el nombre dado en la vista gráfica. Los estilos de rótulo posibles son NOMBRE = 0, NOMBRE_VALOR = 1, VALOR = 2 y (a partir de GeoGebra 3.2) SUBTITULO = 3
void setFixed(String objName, boolean flag) 3.0 Establecer el estado fijo del objeto con el nombre dado. Atención: los objetos fijos no puede modificarse.
void setTrace(String objName, boolean flag) 3.0 Activa o desactiva el rastro del objeto con el nombre dado.
boolean renameObject(String oldObjName, String newObjName) 3.2 Cambia el nombre del objeto del previo, oldObjName al nuevo, newObjName. Indica si se ha logrado renombrarlo
void setLayer(String objName) 3.2 Fija la capa del objeto
void setLayerVisible(int layer, boolean visible) 3.2 Muestra u ocular todos los objetos en la capa dada
void setLineStyle(String objName, int style) 3.2 Fija el estilo del trazo para el objeto (0 a 4)
void setLineThickness(String objName, int thickness) 3.2 Fija el grosor del objeto (1 a 13, -1 por omisión)
void setPointStyle(String objName, int style) 3.2 Fija el estilo de los puntos (-1 por omisión, 0 redondel sombreado, 1 redondel hueco, 2 cuz, 3 signo más, 4 rombo sombreado, 5 rombo hueco, 6 triángulo (al norte), 7 triángulo (al sur), 8 triángulo (al este), 9 triángulo (al oeste))
void setPointSize(String objName, int size) 3.2 Fija el tamaño del punto (desde 1 a 9)
void setFilling(String objName, double filling) 3.2 Fija el sombreado de un objeto (desde 0 a 1)
String getPNGBase64(double exportScale, boolean transparent, double DPI) 4.0 Da por resultado la cadena de la Vista Gráfica 1 codificada en base64
eg var str = ggbApplet.getPNGBase64(1, true, 72);
boolean writePNGtoFile(String filename, double exportScale, boolean transparent, double DPI) 4.0 Exporta la Vista Gráfica 1 a un archivo .PNG (solo para signed applets, firmadas)
eg var success = ggbApplet.writePNGtoFile("c:\\test.png", 1, false, 300);
boolean isIndependent(String objName) 4.0 Controla si el objeto del nombre dado, objName, es independiente
boolean isMoveable(String objName) 4.0 Controla si el objeto del nombre dado, objName es desplazable
String getBase64() Da por resultado la construcción activa como un archivo .ggb codificado en base64
Cadena getBase64(función de llamada-callback-) 4.2 (solo HTML5) Da por resultado la construcción activa como un archivo .ggb codificado en base64 asincrónicamente, pasando como parámetro a la función de llamada -callback- al estar lista. La función de llamada -callback-debiera tomar un parámetro (la cadena base64).
void setBase64(String) 4.0 (solo Java) Establece la construcción activa desde un archivo .ggb codificado como base64
Cadena getBase64(función de llamada-callback-) 4.2 (solo HTML5) Da por resultado la construcción activa como un archivo .ggb codificado en base64 asincrónicamente, pasando como parámetro a la función de llamada -callback- al estar lista. La función de llamada -callback-debiera tomar un parámetro (la cadena base64).

Animación Automática

Firma del Método Desde Descripción
void setAnimating(String objName, boolean animate) 3.2 Establece la posibilidad de animar un objeto. No inicia la animación, para eso debe emplearse startAnimation(), simplemente indica su viabilidad.
void setAnimationSpeed(String objName, double speed) 3.2 Establece la velocidad de animación de un objeto.
void startAnimation() 3.2 Inicia la animación automática para todos los objetos que la tuvieran indicada (flag o bandera de animación así fijada, ver setAnimating())
void stopAnimation() 3.2 Detiene la animación automática para todos los objetos que la tuvieran indicada (flag o bandera de animación así fijada, ver setAnimating())
boolean isAnimationRunning() 3.2 Da por resultado el dato que establece si la animación automática está activa.

Sobre Estado de Objetos

Firma del Método Desde Descripción
double getXcoord(String objName) 2.7 Devuelve la coordenada cartesiana x del objeto con el nombre dado. Atención: Devuelve 0 si el objeto no es un punto o un vector.
double getYcoord(String objName) 2.7 Devuelve la ordenada cartesiana-y- del objeto con el nombre dado. Atención: Devuelve 0 si el objeto no es un punto o un vector..
double getValue(String objName) 3.2 Devuelve el doble valor del objeto con el nombre dado (por ejemplo, la longitud de un segmento, el área de un polígono). Atención: Devuelve 1 si el objeto es una variable booleana con valor cierto -true- y en cualquier otro caso, 0.
double getListValue(String objName, Integer index) 5.0 Devuelve el doble valor del objeto de la lista (con el nombre dado) según el índice establecido. Atención: da 1 para un objeto booleano con valor verdadero y 0 en caso contrario, si es falso.
String getColor(String objName) 2.7 Devuelve el color del objeto especificado del objeto con el nombre dado, como una cadena hexadecimal, por ejemplo,. "# FF0000" es rojo. La cadena hexadecimal siempre comienza con # y no contiene letras minúsculas.
boolean getVisible(String objName) 3.2 Devuelve verdadero o falso dependiendo de si el objeto es visible o no en la Vista Gráfica. Devuelve false si el objeto no existe.
String getValueString(String objName) 2.7 Devuelve una cadena que contiene el valor del objeto indicado.
String getDefinitionString(String objName) 2.7 Devuelve una cadena que contiene la definición del objeto indicado.
String getCommandString(String objName) 2.7 Devuelve una cadena que contiene el comando del objeto del nombre dado.
String getObjectType(String objName) 2.7 Devuelve una cadena que contiene el tipo de objeto determinado (como el "punto", "recta", "círculo", etc.).
boolean exists(String objName) 2.7 Indica si un objeto con el nombre dado existe o no en la construcción.
boolean isDefined(String objName) 2.7 Devuelve si el valor del objeto especificado es actualmente válido.
String [] getAllObjectNames()
Deprecated since 3.0
2.7 Devuelve una matriz que contiene los nombres de todos los objetos en la construcción. Atención: El uso de matrices en JavaScript crea problemas con algunos navegadores.Es preferible emplear getObjectNumber () y getObjectName ().
int getObjectNumber() 3.0 Devuelve el número de objetos en la construcción .
String getObjectName(int i) 3.0 Devuelve el nombre del objeto enésimo de la construcción.
String getLayer(String objName) 3.2 Devuelve la capa a la que está destinado el objeto.
int getLineStyle(String objName) 3.2 Detecta el estilo de línea del objeto indicado (estilo de 0 a 4).)
int getLineThickness(String objName) 3.2 Detecta el ancho de línea (1 a 13)
int getPointStyle(String objName) 3.2 Detecta el estilo de los puntos (-1 por omisión; 0 redondel sombreado; 1 redondel hueco; 2 cruz; 3 signo más; 4 diamante sombreado; 5 diamante hueco; 6 triángulo (norte); 7 Triángulo (sur); 8 triángulo (este); 9 Triángulo (oeste))
int getPointSize(String objName) 3.2 Detecta el tamaño de un punto (desde 1 a 9)
double getFilling(String objName) 3.2 Detecta el tipo de sombreado de un objeto (desde 0 a 1))

Construcción / Interfaz de Uso

Firma del Método Desde Descripción
void setMode(int mode) 2.7 Establece el modo de mouse o ratón (por ejemplo, como una herramienta) en la Vista Gráfica (ver Referencia:Barra de Herramientas y [Referencia:Parámetros Applet|parámetros applet]] y  "customToolBar" )
void openFile(String strURL) 2.7 Abre una construcción desde un archivo (indicado por una cadena con la URL absoluta o relativa)
void reset() 2.7 Actualizar la construcción inicial (que se indica en el parámetro de nombre de archivo en el applet actual).
void refreshViews() 2.7 Actualizar todas las vistas. Atención: todos los rastros serán eliminados de la vista gráfica.
void setOnTheFlyPointCreationActive(boolean flag)
3.2 Activar (true) o desactivado (false) la creación inmediata de puntos en la vista gráfica. Atención: Es muy útil cuando se desea evitar la creación de puntos como un "efecto secundario" de una herramienta. Por ejemplo, cuando este indicador es falso, la herramienta de "recta por dos puntos" no crea puntos por el clic en la vista gráfica.
void hideCursorWhenDragging(boolean flag)
3.2 Ocultar (true) o mostrar (false) el cursor del mouse o ratón (puntero) al arrastrar un objeto para cambiar la construcción.)
void setRepaintingActive(boolean flag)
2.7 Activar (true) o desactivado (false) repintar el applet. Atención: Este método es eficaz sobre todo cuando son varios los métodos invocados.
void setErrorDialogsActive(boolean flag) 3.0 Activar (true) o desactivado (false) mostrar cuadros de diálogo acerca de los errores. Atención: Es muy útil si se utiliza junto con evalCommand ().
void setCoordSystem(double xmin, double xmax, double ymin, double ymax) 3.0 Establece el sistema de coordenadas cartesianas de la Vista Gráfica.
void setAxesVisible(boolean xAxis, boolean yAxis) 3.0 Muestra u oculta los ejes x e y del sistema de coordenadas de la Vista Gráfica.
void setGridVisible(boolean flag) 3.0 Muestra u oculta la cuadrícula de coordenadas de la Vista Gráfica.

Comunicación JavaScript-GeoGebraApplet

Los siguientes métodos permiten implementar un Applet para la comunicación JavaScript. Al emplearlos, es preciso asegurarse de insertar la opción MAYSCRIPT añadida al final de la primera línea de la etiqueta del applet en curso (applet tag). Por ejemplo: <applet name="ggbApplet" code="geogebra.GeoGebraApplet" codebase="." archive="geogebra.jar" width="500" height="250" MAYSCRIPT>. La opción MAYSCRIPT se precisa únicamente para comunicación GeoGebraApplet a JavaScript; no es necesaria para el acceso de JavaScript a los métodos de GeoGebraApplet.

De Firma del Método:
void registerAddListener(String JSFunctionName)
3.0 Registra una función JavaScript como un detector añadido a la construcción del applet. Cuando un objeto se crea en la construcción de GeoGebraApplet, se llama a la función de JavaScript JSFunctionName usando el nombre del objeto recién creado como su único argumento.

Ejemplo: Primero, registra una función de detección de JavaScript:

ggbApplet.registerAddListener( "myAddListenerFunction" );

Cuando se crea un objeto "A", el applet de GeoGebra llama a la función JavaScript

myAddListenerFunction(" A");
De Firma del Método:
void unregisterRemoveListener(String objName)
3.0 Elimina un detector añadido previamente registrado, ver registerAddListener()
De Firma del Método:
void registerRemoveListener(String JSFunctionName
3.0 Registra una función de detección de JavaScript como detector de eliminación para la construcción de applet. Siempre que un objeto es eliminado en la construcción activa en el GeoGebraApplet, se llama a la función de JavaScript JSFunctionName utilizando como único argumento el nombre del objeto eliminado. Atención: Cuando se cancela toda la construcción, remove no es llamado por un objeto individual: ver registerClearListener().

Ejemplo: Registrar una función de detector por encima de una función JavaScript:

ggbApplet.registerRemoveListener(" myRemoveListenerFunction ");

Cuando un objeto "A" se elimina, el applet de GeoGebra llama a la función JavaScript

myRemoveListenerFunction("A");
De Firma del Método:
void unregisterRemoveListener(String objName)
3.0 Elimina un detector previamente registrado, ver registerRemoveListener()
De Firma del Método:
void registerUpdateListener(String JSFunctionName)
3.0 Registra una función JavaScript como detector de actualización para la construcción del applet. Cuando un objeto es actualizado en la construcción activa en GeoGebraApplet, es llamada una función JavaScript JSFunctionName utilizando como único argumento el nombre del objeto actualizado.Atención: Si se detector exclusivamente vinculado a la actualización de un determinado objeto, es mejor emplear registerObjectUpdateListener() .

Ejemplo: Registrare innanzitutto una funzione listener JavaScript:

ggbApplet.registerUpdateListener(" myUpdateListenerFunction ");

Cuando un objeto "A" se actualiza, el applet de GeoGebra llama a la función Javascript

myUpdateListenerFunction("A");
De Firma del Método:
void unregisterUpdateListener(String objName)
3.0 Elimina un detector previamente registrado, ver registerRemoveListener()
De Firma del Método:
void registerObjectUpdateListener(String objName, String JSFunctionName)
3.0 Registra una función JavaScript como detector de actualización para un objeto individual. Cuando el objeto con el nombre dado se actualiza, la función JavaScript JSFunctionName es llamada usando el nombre del objeto actualizado como su único argumento. Si objName tenía previamente una función JavaScript mapeada, el valor previo es reemplazado. Atención: todos los detectores de actualización de objeto quedan no registrados cuando sus objetos se eliminan de la construcción o la construcción se borra, ver registerRemoveListener() and registerClearListener().

Ejemplo: Primero, registrar una función de detección de JavaScript:

ggbApplet.registerObjectUpdateListener("A", "myAupdateListenerFunction");

Cuando el objeto A se actualiza, el Applet GeoGebra llamará a la función Javascript

myAupdateListenerFunction("A");

Atención: un detector de actualización de objeto operará aún después de haber sido renombrado el objeto.

De Firma del Método:
void unregisterObjectUpdateListener(String objName)
3.0 Elimina un detector de actualización de objeto (con el nombre dado), previamente registrado, ver registerObjectUpdateListener()
De Firma del Método:
void registerRenameListener(String JSFunctionName)
3.0 Registra una función JavaScript como detector de cambio de nombre para el applet de la construcción. Cuando a un objeto se le cambia el nombre en la construcción del GeoGebraApplet, la función JavaScript JSFunctionName es llamada usando el viejo nombre y el nuevo del objeto rebautizado como sendos argumentos.

Ejemplo: Primero, registrar una función de detección de JavaScript:

ggbApplet.registerRenameListener("myRenameListenerFunction");

Cuando a un objeto "A" se la cambia el nombre por "B", el Applet GeoGebra llamará a la función de Javascript

myRenameListenerFunction("A", "B");
De Firma del Método:
void unregisterRenameListener(String objName)
3.0 Elimina un detector de cambio de nombre de objeto previamente registrado, ver registerRenameListener()
De Firma del Método:
void registerClearListener(String JSFunctionName)
3.0 Registra una función JavaScript como detector de borrado para el applet de la construcción. Cuando la construcción de la GeoGebraApplet se borra (por ejemplo, todos los objetos son eliminados), la función JavaScript f JSFunctionName es llamada sin argumentos. Atención: todos los detectores de actualización quedan sin registro cuando una construcción es borrada. Ver registerUpdateListener() yregisterRemoveListener().

Ejemplo: Primero, registrar una función de detección de JavaScript

ggbApplet.registerClearListener("myClearListenerFunction");

Cuando la construcción se borra (por ejemplo. después de reajustar una construcción o abrir a un nuevo archivo de construcción), el Applet GeoGebra llamará a la función Javascript

myClearListenerFunction();

Formato XML de GeoGebra

Con estos métodos se puede establecer prácticamente todo en una construcción (ver Referencia XML ).

Firma del Método Desde Descripción
void evalXML(String xmlString) 2.7 Evalúa la cadena XML dada y cambia la construcción activa. Atención: la construcción no es borrada antes de la evaluación de la cadena XML.
void setXML(String xmlString) 2.7 Evalúa la cadena XML dada y cambia la construcción activa. Atención: la construcción es borrada antes de la evaluación de la cadena XML. Este método puede emplearse para cargar construcciones.
String getXML()
2.7 Da por resultado la construcción activa en formato XML de GeoGebra. Este método puede emplearse para guardar construcciones.
String getXML(String objName)
3.2 Da por resultado la cadena XML de GeoGebra para el objeto dado, por ejemplo, solo la etiqueta o tag del <elemento> deviene resultado.
String getAlgorithmXML(String objName)
3.2 Para un GeoElemento objName dependiente, deviene resultado la cadena XML del algoritmo precedente y todos sus objetos de salida. Para un GeoElemento objName libre, la salida resultante es "".

Misceláneas

Firma del Método Desde Descripción
String evalMathPiper(String string) 3.2 Pasa la cadena a MathPiper y establece el resultado como una Cadena.

Eliminado en GeoGebra 4.0 y será reemplazado con evalGeoGebraCAS() wn GeoGebra 4.2

String getIPAddress() 3.2 Da por resultado la dirección de IP de la computadora local como una Cadena; por ejemplo, "192.168.0.4"
String getHostname() 3.2 Da por resultado el nombre del host de la computadora local como una Cadena
void debug(String string) 3.2 Imprime la cadena de la Consola Java

Obtención del Objeto Applet

En los casos básicos el applet está en la variable global ggbApplet.
Se listan, a continuación, las excepciones:

  • para aplicaciones múltiples -applets- en una página, dado que solo una es aceptable por omisión desde JavaScript.
    Para acceder, entonces, a múltiples applets, se deberá fijar el parámetro "id" de las aplicaciones particulares, de modo que resulte el nombre de la variable global que representa a tal aplicación plural (applet múltipole)
  • exportar desde GeoGebra 4.0 y desde aplicaciones previas es aún accesible en tanto se trate de un document.applets[0] y para incluir otros applets en la misma página serán respectivamente document.applets[1], document.applets[2], document.applets[3]...

© 2024 International GeoGebra Institute