Sunday, 21 June 2015

How to create popup window?.

It's is very simple to create popup window in titanium


The app.js file is given below

var window = Ti.UI.createWindow({
height:"100%",
width:"100%",
top:"0%",
left:'0%'
});
var view = Titanium.UI.createView({
borderRadius:10,
backgroundColor: '#fff',
top: '0%',
left: '1%',
width: '100%',
height: '100%'
});
window.add(view);
var button = Titanium.UI.createButton({
    title: 'Add Reminder',

backgroundColor: '#2111B4',
    top: '20%',
    left: '25%',
    width: '43%',
    height: '8%'
});
view.add(button);
button.addEventListener('click',function(e)
{
    //Titanium.API.info("You clicked the button");
    //alert("Hi this Alert Message");
    var popupwindow=Ti.UI.createWindow({
    title:"Popup Window",
    modal:true,
    url:"module/popupwindow.js"
   
    });
    popupwindow.open();
});


the modal  should be give as modal:true


var window = Ti.UI.currentWindow;
var closeimag=Ti.UI.createImageView({
image:'/images/close.png',
top: '7%',
left: '85%',
width: '12%',
height: '13%',
});
view.add(closeimag);

var lineimage=Ti.UI.createImageView({
image:'/images/line.png',
width:'100%',
top:'20%',
left:'0%'
});
view.add(lineimage);

var label1 = Ti.UI.createLabel({
    color: '#4C4C4D',
    font: { fontSize:14 },
    text: 'Set Reminder',
    textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,
    top: '10%',
    left: '26%',
    width: '44%',
    height: '8%',
});
view.add(label1);
var remidertitle = Ti.UI.createTextField({
borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
color: '#4C4C4D',
top: '25%',
left: '5%',
width: '90%',
height: '20%',
hintText: 'Reminder Name'
});
view.add(remidertitle);

closeimag.addEventListener('click',function(e)
{
     Titanium.API.info("You clicked the Cancel button");
     window.close();
});

button1.addEventListener('click',function(e)
{
   alert('add');
});