createWindow url file code not being run

You must Login before you can answer or comment on any questions.

So I'm trying to create a new window for a new support view within mobile app. from app.js I createWindow then after that opened it. With that process in mind I created the support.js and added all my form items thinking I would then add them back to the view, however its just not connecting up. It's Friday, what I am not getting here? Am I just not getting the entire concept of moving a view's code under its own file completely wrong, or what? How am a suposta build this out?

app.js

/*
             * Launch feedback process
             */
                var supportWindow   =   Ti.UI.createWindow({
                    backgroundColor:    '#fff',
                    url:                            'support.js',
                    title:                      'Support',
                    backgroundImage:    './images/ltBG.png',
                });
 
                supportWindow.open();
support.js
var emailField = Titanium.UI.createTextField({
                    hintText:' email address',
                    height:35,
                    top:5,
                    left:5,
                    right:5,
                    borderRadius:           5,
                    backgroundColor:    '#fff',
                    borderColor:            '#8c8c8c',
                    borderWidth:            1,
 
                    paddingLeft:            2,
                    paddingRigh:            2,
                    paddingBottom:      2,
                    paddingTop:             2,
 
                });
 
                var commentLabel = Titanium.UI.createLabel({
                    text:'Comments:',
                    height: 'auto',
                    width:  'auto',
                    color:'#9c9c9c',
                    top:        emailField.getTop()+emailField.getHeight()+5,
                    left: 5,
                    font:{fontSize:16},
                    textAlign:'left',
                });
 
                var commentField = Titanium.UI.createTextArea({
                    hintText:'Your Feedback...',
                    height:                     330,
                    top:                            commentLabel.getTop()+commentLabel.getHeight()+5,
                    left:                           5,
                    right:                      5,
                    borderRadius:           5,
                    backgroundColor:    '#fff',
                    borderColor:            '#8c8c8c',
                    borderWidth:            1,
 
                });             
                var feedbackButton = Titanium.UI.createButton({
                    title:                      'Submit Feedback',
                    height:                     40,
                    color:                      '#000',
                    top:                            commentField.getTop()+commentField.getHeight()+5,
                    left:                           0,
                    right:                      0,
 
                    backgroundImage:'./images/BUTT_gry_off.png',
                    backgroundSelectedImage:'./images/BUTT_gry_on.png',
                })
 
 
                // ADD event listener for the submit feedback button
 
                feedbackButton.addEventListener('click', function(e)
                {
 
 
                    // Lets create a style of pop-up that will give them a couple options.
                    var alertNotice = Ti.UI.createAlertDialog({
                        buttonNames: ['Bug', 'Feature','Other','Cancel'],
                        title: 'Support',
                        message: 'What type of support issue is this?',
                    });
                    alertNotice.show();
                    alertNotice.addEventListener('click', function(e){
                        if(e.index === 0){
                            //  
                            supportWindow.close();
                            //win.open();
                        }
                        if(e.index === 1){
                            //
                            supportWindow.close();
                            //win.open();
                        }
                        if(e.index === 2){
                            //
                            supportWindow.close();
                            //win.open();
                        }
                        if(e.index === 3){
                            //
                            //supportWindow.close();
                            //win.open();
                        }                                               
                    });
                });     
 
                supportWindow.add(emailField,commentLabel,commentField,feedbackButton);

— asked 1 year ago by Levi Thornton
1 Comment
  • I think I found the correct method. Under the support.js add to the top

    var Win = Ti.UI.currentWindow;
    Then down at the bottom change supportWindow.add(..., to Win.add(... and that will bind it all up, show the forms and allow you to close the window properly. You will still need to open the window in app.js with createWindow

    — commented 1 year ago by Levi Thornton

Your Answer

Think you can help? Login to answer this question!