Been looking at the widgets to find a space-saving solution for my app.
I have about 7 songs/rhythm tracks the user should be able to play. I also have widgets to PAUSE and STOP the music. I have no space to put widgets to represent the music selections. So, Picker Wheel seems a possible solution.
Can the picker wheel be used as such and when using the sample code at the University, how would I reference the labels in order to allow PLAY, PAUSE and STOP widgets to control the music?
If you think this is a stupid way to do this and can point me in another direction, I’m all eyes and ears.
Thanks for your help and advice!
local widget = require( “widget” )
– Create one tables to hold data for songs
local songs = {}
– Configure the picker wheel columns
local columnData =
{
– Songs
{
align = “center”,
width = 200,
startIndex = 1,
labels = { “Crazy Song”, “Insane Chant”, “Rasta Wrap”, “Find the Soundz”, “Karaoke”, “Jawbone Jam” }
},
}
– Create the widget
local pickerWheel = widget.newPickerWheel
{
left = display.contentWidth /2 -150,
top = display.contentHeight - 220,
font = “Bauhaus 93”,
fontSize = 25,
columnColor = { .1, .9, .1 },
columns = columnData,
}
– This can be performed on a button tap, timer execution, or other event
local values = pickerWheel:getValues()
–[{Get the value for each column in the wheel (by column index)
local currentsong = values[1].value
]]–
print( currentsong )