// this sets the background color of the master UIView (when there are no windows/tab groups on it)
//Ti.include('Window1.js');
Titanium.UI.setBackgroundColor('#000');
// create tab group
var placeHolders = [{left:10, top:10, width:20, height:20, bgColor:"#FFF", bgAlpha:0.5, img:""},
{left:30, top:20, width:50, height:50, bgColor:Math.random * 0xFFFFFF, bgAlpha:0.5, img:""},
{left:60, top:60, width:20, height:20, bgColor:Math.random * 0xFFFFFF, bgAlpha:0.5, img:""},
{left:100, top:20, width:20, height:20, bgColor:Math.random * 0xFFFFFF, bgAlpha:0.5, img:""},
{left:50, top:100, width:20, height:20, bgColor:Math.random * 0xFFFFFF, bgAlpha:0.5, img:""}
];
var tabGroup = Titanium.UI.createTabGroup();
var parentWindow = Titanium.UI.createWindow({
title:'Tab 1',
backgroundImage:"assets/background.png",
backgroundColor:'#fff',
navBarHidden:true,
tabBarHidden:true
});
addPlaceHolders();
function addPlaceHolders()
{
for(i = 0; i < placeHolders.length; i++)
{
var placeHolder = placeHolders[i];
var placeHolderView = Titanium.UI.createView({
top:placeHolder.top,
left:placeHolder.left,
height:placeHolder.height,
width:placeHolder.width,
backgroundColor:placeHolder.bgColor,
opacity:placeHolder.bgAlpha
});
placeHolderView.name = i;
parentWindow.add(placeHolderView);
placeHolderView.addEventListener("click", onPlaceHolderClick);
}
}
var main = Titanium.UI.createTab({
title:'Tab 1',
window:parentWindow
});
// add tabs
tabGroup.addTab(main);
// open tab group
tabGroup.open();
function onPlaceHolderClick(e)
{
//tell me wot to do here
alert("tell me wo to do here");
}