Skip to Content

Hola Mundo IFbA

Crearemos ahora el clásico hola mundo. Para ello debemos crear un objeto miDialogo. Dentro de este una propiedad description la cual será un objeto que tendrá dentro una propiedad elements. Dentro de la propiedad elements, la cual es un vector, agregaremos un único objeto para representar un texto estático. Este objeto tendrá una propiedad name = “Hola mundo IFbA” y una propiedad type = “static_text”.

Finalmente mostraremos el diálogo con el método execDialog del objeto app.

Mostraré el código tanto en notación convencional como literal.

Notación convencional

var miDialogo = new Object(); //Creo el objeto dialogo

miDialogo.description = new Object(); //Creo la propiedad description

miDialogo.description.elements = new Object(); //Creo la propiedad elements (array de objetos del diálogo)

miDialogo.description.elements[0] = new Object(); //Creo un elemento de tipo texto estático

miDialogo.description.elements[0].name = “Hola mundo IFbA”;

miDialogo.description.elements[0].type = “static_text”;

var retn = app.execDialog(miDialogo); //Muestro el dialogo

Notación literal

var miDialogo = new Object(); // Creo el objeto dialogo

//Cargo toda la estructura del objeto dialogo

miDialogo = {

            description: {

                        elements:

                        [

                                   {

                                               name: “Hola mundo IFbA”,

                                               type: “static_text”

                                   }

                        ]

            }

};

app.execDialog(miDialogo); //Muestro el dialogo

El resultado:

En las próximas entradas iremos construyendo diálogos más complicados en forma gradual.

English version

Hello World IFbA

Now we’ll create the classic hello world dialog. We’ll need to create an object for the dialog. Inside this object we’ll have a description property which is an object. The description object will have an elements property which is an array that will contain only one object representing an static text. This object will have two properties: name = “Hello world IFbA” and type = “static_text”.

Finally we’ll show the dialog with the execDialog method of the app object.

I will show the code both in conventional and literal notation.

Conventional notation

var myDialog = new Object(); //Dialog object creation

myDialog.description = new Object(); //Description property creation

myDialog.description.elements = new Object(); //Elements property creation (array)

myDialog.description.elements[0] = new Object(); //Creation of an static text element

myDialog.description.elements[0].name = “Hello World IFbA”;

myDialog.description.elements[0].type = “static_text”;

var retn = app.execDialog(myDialog); //Show the Dialog

Literal notation

var miDialogo = new Object(); // Dialog object creation

//Set the complete object structure

miDialogo = {

            description: {

                        elements:

                        [

                                   {

                                               name: “Hello World IFbA”,

                                               type: “static_text”

                                   }

                        ]

            }

};

app.execDialog(miDialogo); //Show the dialog

The result:

In next posts we’ll gradually build more complex dialogs.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply