Hi,
So i am trying to create a tabbed app:
Tab1 > Window 1 > Window 2 > Window 3
Tab 2 would be the same.
I have followed the template from Appcelerator Developer relations example: https://github.com/appcelerator-developer-relations/Template.Tabbed
Once I have the first window open, I want the button click to open another window.
The example is:
function ApplicationWindow(title) { var self = Ti.UI.createWindow({ title:title, backgroundColor:'white' }); var button = Ti.UI.createButton({ height:44, width:200, title:L('openWindow'), top:20 }); self.add(button); button.addEventListener('click', function() { //containingTab attribute must be set by parent tab group on //the window for this work self.containingTab.open(Ti.UI.createWindow({ title: L('newWindow'), backgroundColor: 'white' }));
This just creates and opens a New window. I want to open a window that is in another file win2.JS:
This is the code in win2.JS:
function Win2() { var nextWin = Ti.UI.createWindow({ title : title, backgroundColor : 'white' }); return nextWin; }; module.exports = Win2;This is my code to call this from the original one:
button.addEventListener('click', function() { testWin = require('win2'); self.containingTab.open(testWin);My attempts so far have resulted in [WARN] Exception in event callback. { on iOS.....
Not sure where it is going wrong or what to change in the code...
1 Answer
Accepted Answer
You appear to be passing a function to the tab to open not a window object.
Your Answer
Think you can help? Login to answer this question!