Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3073] Reopening a window creates duplicates scrollview

GitHub Issuen/a
TypeBug
PriorityTrivial
StatusClosed
ResolutionInvalid
Resolution Date2011-04-15T03:36:07.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.6.0 M10
ComponentsAndroid
Labelsandroid, defect, release-1.6.0
Reporterpete
AssigneeDon Thorp
Created2011-04-15T03:36:06.000+0000
Updated2017-03-02T19:32:42.000+0000

Description

When I click to reopen a window I get multiple instances of that window. Either it is being opened twice the 2nd time or never really closed. Please see the example code for a better explanation.

The code below is a simplified version of my project to show the error.

app.js

 var win1 = Titanium.UI.createWindow({
backgroundColor:'#000',
exitOnClose:true,
navBarHidden:true,
orientationModes: [Ti.UI.PORTRAIT],
zIndex:-1}
 );
 
 win1.open();

var body = Titanium.UI.createScrollView({
    right:0,left:0,top:60,bottom:50,width:'auto',height:'auto'
    });
    
var button = Titanium.UI.createButton({
    title:'click to open',
    top:190,
    left:30,
    height:50,
    width:250,
    font:{fontSize:20}
});

body.add(button);
win1.add(body);

button.addEventListener('click', function(){
    win3.open();
    });

var win3 = Titanium.UI.createWindow({
    title: 'Window 3',
    name: 'Window 3',
    backgroundColor: '#C4D5DA',
    fullscreen: false,
    animate: ({opacity: 0,duration: 300 }),
    url: 'win3.js'
    });

win3.js

var win3 = Titanium.UI.currentWindow;

var body = Titanium.UI.createScrollView({
    contentWidth:Titanium.Platform.displayCaps.platformWidth,contentHeight:500,
    right:0,left:0,top:60,bottom:50,width:'auto',height:'auto',
    showHorizontalScrollIndicator:false,showVerticalScrollIndicator:false});

win3.add(body)

var button = Titanium.UI.createButton({
    title:'click to close',
    top:190,
    left:30,
    height:50,
    width:250,
    font:{fontSize:20}
});

body.add(button);

button.addEventListener('click', function(){

    win3.close();
    });

Comments

  1. Don Thorp 2011-04-15

    Please use Q&A for support issues. You need to create the window in the button click handler and open it there.

  2. pete 2011-04-15

    Why is this invalid?

  3. pete 2011-04-15

    I have been trying to get help with this for 2 months now. If it is invalid, please tell me why and I will correct my code. My code works just fine with iPhone.

  4. Lee Morris 2017-03-02

    Closed as invalid.

JSON Source