Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // File: app.js
- Ti.include('windows.js');
- var window = Ti.UI.createWindow();
- var thisWinCreated = createMyWin();//Created From Windows.js
- var modalWin = Ti.UI.createWindow({
- backgroundColor:"red",
- url:thisWinCreated
- });
- //open a main window in a navGroup and add 1 button
- var nav = Ti.UI.iPhone.createNavigationGroup({
- window:modalWin
- });
- window.add(nav);
- var btn1 = Titanium.UI.createButton({
- title:'Test', top:100, left:20, width:200, height:30
- });
- modalWin.setRightNavButton(btn1);
- btn1.addEventListener('click', function(e){
- thisWinCreated.open({modal:true});
- });
- window.open();
- //File: windows.js
- function createMyWin(){
- Ti.API.info('My Window has been created');
- var win = Ti.UI.createWindow({
- backgroundColor:'green',
- title:'My window created',
- });
- win.orientationModes = [
- Ti.UI.PORTRAIT,
- Ti.UI.UPSIDE_PORTRAIT
- ];
- var done = Titanium.UI.createButton({
- systemButton:Titanium.UI.iPhone.SystemButton.DONE
- });
- win.setRightNavButton(done);
- done.addEventListener('click',function()
- {
- win.close();
- });
- win.addEventListener('focus', function(){
- setTimeout(function()
- {
- Ti.API.info('3 secs elapsed ... Closing Window');
- win.close();//will be closed in 3 secs ...
- },3000);
- });
- return win;
- };
Add Comment
Please, Sign In to add comment