Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Open new window on button click

Hi,
I need to open a new window when a button click event is fired. Ti.UI.CurrentWindow is not working for me in the new_window.js

//onclik

Ti.API.info('event button clicked')
var eventWin = Ti.UI.createWindow({
url:'new_window.js',
title:'Events'
});
Ti.API.info('eventwin in app.js: ' + eventWin);
eventWin.open();

I'm getting an error at 0,0..

— asked November 11th 2010 by Subair Ariyil
  • button
  • new
  • window
0 Comments

3 Answers

  • First of all use the syntax formatting. Your post is much easier to read.

    Second:

    var eventWin = Ti.UI.createWindow({ 
       url:'new_window.js', 
       title:'Events',
       modal: true 
    }); 
    Ti.API.info('eventwin in app.js: ' + eventWin); 
    eventWin.open();
    

    Try to add modal:true maybe this does the trick for you.

    — answered November 11th 2010 by Jacob van Dam
    permalink
    1 Comment
    • Thanks Jacob van Dam, thank you very much. I'm learner and I was to give up.

      — commented July 29th 2013 by Gaurav Rai
  • may i know what is the syntax followed in new_window.js

    — answered February 24th 2013 by kiran kumar reddy G
    permalink
    0 Comments
  • Ti.UI.currentWindow will not be available in your new window because it is out of context.
    The reason is because you are opening a standalone window and not a window opened by a navigation controller (Tab Group or Navigation Group).
    i.e. Ti.UI.currentWindow is only available to windows opened via a Tab/Navigation group.

    — answered November 11th 2010 by Roger Chapman
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.