Skip to content

Instantly share code, notes, and snippets.

@ranguard
Created March 10, 2010 12:33
Show Gist options
  • Save ranguard/327817 to your computer and use it in GitHub Desktop.
Save ranguard/327817 to your computer and use it in GitHub Desktop.
// Not correct (last label in bad location) - but useful for reference
var prices = [
'175',
'250',
'350',
'500',
'700',
'1000',
'2000'
];
var price_units = prices.length;
var bar_width = 300;
for(var i=0; i < price_units; i++) {
var text = prices[i] + 'k';
if(i == prices.length) {
text += '+';
}
var left = factory.default_left() + (i * (bar_width / (price_units - 1)));
Ti.API.info(text + " -> " + left);
var thing = factory.addLabel({
top: local_top,
win: view_search_options,
label_height: 30,
left: left,
text: text
});
}
local_top += 40;
var basicSlider = Titanium.UI.createSlider({
min:0,
max: price_units,
value:1,
width:bar_width,
height:'auto',
top:local_top,
});
basicSlider.addEventListener('change',function(e)
{
var foo = prices[Math.floor(e.value)];
Ti.API.info("NP:" + foo);
price.text = 'v = ' + factory.priceOut(foo) + ' act val ' + basicSlider.value;
});
view_search_options.add(basicSlider);
local_top += 40;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment