Creating buttons


show more Creating buttons provides you with in-depth training on Developer. Taught by Rafael Hernandez as part of the Titanium Mobile App Development Essential Training show less
please wait ...

Creating buttons

Titanium Mobile allows for the creation of both native and custom buttons. Starting with the app.js file in the 03 _02 folder of the exercise files, I've created a new window object. Next, I'll switch to the completed code and copy the code snippet for creating a new button. The Titanium.UI.createButton method creates a new button object. At a minimum, I have to supply dimension properties for the object or else the button will fill the entire screen. I've used the title property to display text on the button.

I've also added a custom property called id to the button object. I'll be retrieving this property with an EventListener in a moment. With the button object created, I'll add it to the window object. Now I'll add an EventListener to the button and listen for the click event. Within the click event I'll create a callback to fire an Alert dialog, that will a return string containing the source, object's ID property, and the type property of the event...

Creating buttons
Video duration: 2m 17s 3h 3m Beginner

Viewers:

Creating buttons provides you with in-depth training on Developer. Taught by Rafael Hernandez as part of the Titanium Mobile App Development Essential Training

Subjects:
Developer Web
Software:
Titanium
Author:
please wait ...