Hello forum!
This is an interesting bug that appears if the user scrolls far out of the bounds of values in a given column of a pickerWheel. When the user does this, the column loses its selection, and pickerWheel:getValues() becomes nil. This causes a whole host of problems, and hopefully is something that can be fixed. I have built in workarounds in my projects that utilize pickerWheels, but they are messy, as there is no way to force a selection of an item that I can find. You could use the undocumented scrolltoindex, but that also does not force the selection, just scrolls to an index, thus not a viable workaround.
To demonstrate this simply, I used the unmodified example code from the pickerWheel documentation, and appended a short bit of code that prints the values of pickerWheel:getValues() every second. You will notice that once you scroll one of the columns far out of range, dragging your mouse/finger all the way off the simulator window, the respective getValues table becomes nil, and will not become valid again until you interact with that column again.
Let me know if you need any further clarification, cheers!
local widget = require( "widget" ) -- Create two tables to hold data for days and years local days = {} local years = {} -- Populate the "days" table for d = 1, 31 do days[d] = d end -- Populate the "years" table for y = 1, 48 do years[y] = 1969 + y end -- Configure the picker wheel columns local columnData = { -- Months { align = "right", width = 140, startIndex = 5, labels = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" } }, -- Days { align = "center", width = 60, startIndex = 18, labels = days }, -- Years { align = "center", width = 80, startIndex = 10, labels = years } } -- Create the widget local pickerWheel = widget.newPickerWheel { top = display.contentHeight - 222, columns = columnData } -- Get the table of current values for all columns -- 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 currentMonth = values[1].value local currentDay = values[2].value local currentYear = values[3].value print( currentMonth, currentDay, currentYear ) -- ---------------------------------------------- local function demonstrateglitch() print("Column 1: ") print(pickerWheel:getValues()[1]) print("\n") print("Column 2: ") print(pickerWheel:getValues()[2]) print("\n") print("Column 3: ") print(pickerWheel:getValues()[3]) print("\n\n") end timer.performWithDelay(1000,demonstrateglitch,0)