Created
December 28, 2010 02:43
-
-
Save mattyb/756834 to your computer and use it in GitHub Desktop.
titanium picker won't display
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
warningTimeRow.addEventListener('click', function(e) { | |
try { | |
var root = Ti.UI.createView({}); | |
var dialog = Ti.UI.createOptionDialog({ | |
androidView:root, | |
options:null, | |
buttonNames: ['Set','Cancel'], | |
title:'Advanced warning' | |
}); | |
var view = Ti.UI.createView({ | |
width : 300, height: '75' | |
}); | |
root.add(view); | |
} catch (e) { | |
Ti.API.warn('failed to initialize warning time window: '+e.description); | |
} | |
try { | |
var wTPicker = Titanium.UI.createPicker({ | |
color:'#999', | |
font:{fontSize:12,fontFamily:'Helvetica Neue'}, | |
width:'auto', | |
height:'auto', | |
top:0, | |
useSpinner:true | |
}); | |
var col = Titanium.UI.createPickerColumn(); | |
Ti.API.debug('added wait time picker column'); | |
var wTPicker = Titanium.UI.createPicker(); | |
var data = []; | |
for (i=0; i<=30; i++) { | |
data.push(Titanium.UI.createPickerRow({title:''+i})); | |
Ti.API.trace('added wait time picker row'+i); | |
} | |
wTPicker.add(data); | |
wTPicker.selectionIndicator=true; | |
Ti.API.debug('added wait time col to picker'); | |
view.add(wTPicker); | |
Ti.API.debug('added wait time picker to view'); | |
} catch (e) { | |
Ti.API.warn('failed to initialize warning time picker: '+e.description); | |
} | |
dialog.addEventListener('click', function(e) { | |
Titanium.API.debug('warning time window closed'); | |
if (e.index == 0) { //make sure "set" button was pushed | |
try { | |
Titanium.API.debug('warning time is '+wTPicker.getSelectedRow(0).title); | |
Titanium.App.Properties.setInt('WarningTime',parseInt(wTPicker.getSelectedRow(0).title)); | |
Titanium.API.debug('warning time property set to ' +wTPicker.getSelectedRow(0).title); | |
warningTimeChoiceLabel.text = wTPicker.getSelectedRow(0).title+' min'; | |
Titanium.API.debug('warning time label changed'); | |
} catch (e) { Ti.API.warn("couldn't set warning time: "+e.description);} | |
} else { | |
Titanium.API.debug('...via cancel'); | |
} | |
}); | |
try { | |
dialog.show(); | |
Titanium.API.debug('warning time window open'); | |
} catch (e) { | |
Ti.API.warn('failed to show warning time dialog: '+e.description); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment