Titanium Community Questions & Answer Archive

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

Buttons not working

Hi! Titanium noob here so be gentle :)
here is the code…


app.js

var navigationButton = Titanium.UI.createButton({
title : 'NAVi'
});

var navigationWindow = Titanium.UI.createWindow({
    url        : 'navigationWindow.js'
});

navigationButton.addEventListener('click',function(e)
{
    navigationWindow.open();
});

navigationWindow.js

var label = Titanium.UI.createLabel({
text : 'getting GPS settings'
});

var button = Titanium.UI.createButton({
title:'refresh GPS'
});

button.addEventListener('click', function(e){
label.text ='refreshing gps'

});

I have a 3x3 grid of buttons on my app.js and each button opens up a new window. the code above is one of those buttons, the 'navigationWindow.js' contains code to track the users geo location, and this works fine, my problem is, the buttons inside the 'navigationWindow.js' wont trigger any 'click' event, the buttons just float in the screen…right now the buttons are just setup to change a label text. this happens both in the emulator and in the device (using android and iphone)….am i doing something wrong or do I need to add more code on the buttons? please help…Thanks!!!!

— asked December 2nd 2010 by irving dela cruz
  • android
  • ipad
  • iphone
1 Comment
  • can you post the code using http://pastie.org/

    — commented December 2nd 2010 by Aaron Saunders

2 Answers

  • Irving

    I second Aaron's comment. The code you have pasted seems to be incomplete. Would you post it to either pastebin or gist?

    Thanks

    — answered December 3rd 2010 by Paul Dowsett
    permalink
    1 Comment
    • btw, what Ti SDK version are you using, and which platform are you testing this on primarily?

      — commented December 3rd 2010 by Paul Dowsett
  • I think I just found the problem, I think its the way im adding my "navigationWindow" to the screen. Is there a way to set an added window to be the active window? I think Im using the latest SDK of Ti, I just updated it…. I am on mac but I am testing it on an android device…

    — answered December 5th 2010 by irving dela cruz
    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.