When closing a child window with Ti.UI.Window.close(), the whole application get closed.
var win = Ti.UI.createWindow();
function initWebViewWindow(url, timeout) {
var self = Ti.UI.createWindow({
backgroundColor : 'white'
});
var view = Ti.UI.createView({
top : '90%',
left : 0,
height : '10%',
backgroundColor : '#08A7DC'
});
var backView = Ti.UI.createView({
left : 0,
top : 0,
width : '100%',
bottom : 0
});
var backLabel = Ti.UI.createLabel({
top : 4,
left : 10,
right : 0,
bottom : 0,
text : 'Back',
color : 'white',
font : {
fontSize : 16,
fontFamily : 'Helvetica Neue'
},
textAlign : 'center',
touchEnabled : false
});
backView.add(backLabel);
view.add(backView);
backView.addEventListener("click", function(e) {
Ti.API.info('-------------------> backView click');
self.close(); // <<<<==== This accidentially closes the whole Application!!!
});
self.add(view);
var webview = Ti.UI.createWebView({
top : 0,
left : 0,
right : 0,
height : '90%',
url : url
});
// TODO: timeout not there yet
// webview.setTimeout(timeout);
webview.addEventListener('load', function(e) {
Ti.API.info('-------------------> webview load');
Ti.API.info(e);
});
webview.addEventListener('beforeload', function(e) {
Ti.API.info('-------------------> webview beforeload');
Ti.API.info(e);
});
webview.addEventListener('error', function(e) {
Ti.API.info('-------------------> webview error');
Ti.API.info(e);
});
self.add(webview)
return self;
}
var button = Ti.UI.createButton({
title : 'open WebView Window'
});
button.addEventListener('click', function(e) {
var webViewWindow = initWebViewWindow('http://www.google.com', 5000);
webViewWindow.open();
});
win.add(button);
win.open();
Is there any workaround I can use instead of self.close() ? This Bug is really a showstopper for me now. Thank you very much.
It looks like the application is crashing when close is called on the window. Debugging now and will try to get a fix once I have found a solution.
Josh, thank you very much for the quick response. I tested with mobilesdk-3.1.0.v20130226221017-osx and it works as expected.
Verified the issue & working as expected.Thus closing. Environment: Ti Studio : 3.1.0.201302221817 Ti BB SDK : 3.1.0.v20130227112907 Mac OSX : 10.8.2 win 7 Win 8 BB simulator : 10.0.10.261 Dev alpha B 10 device