This is driving nuts. All I want to do is make a super simple Pickerwheel that updates the text of a display.newText when you tap the pickerwheel itself. And I’m running into all sorts of weird problems.
I swear, Corona is SO not business app friendly!
I have created the pickerwheel with 1 column and 4 rows. I have added a “Tap” listener to the wheel with a function that uses the getValues() method on the wheel to update the display.newText with the currently selected value of the wheel.
Should be simple I thought.
So the problems I face are:
-
On the first “Tap” the wheel automatically moves to select the last row returns NIL, but doesn’t crash.
-
On all following taps, if the wheel is at the VERY top or VERY bottom row (As in, I flick hard enough to make it bounce) it works perfectly. Also, If it’s at the very top when I tap,it shoots the wheel down to the last row again.
If the selector is on ANY other row it attempts to return NIL and crashes the app. I don’t understand why:
A: It keeps auto selecting the last row after a tap
B: Only the first and last rows work?
Here is my code:
local function sineBarSize( event ) local values = sizePicker:getValues() sineSize.text = values[1].value end sizePicker = widget.newPickerWheel { top = display.contentHeight - 222, font = "Rock Salt", fontSize = 14, columns columnData } sizePicker:setReferencePoint(display.CenterReferencePoint) sizePicker.x = display.contentCenterX screenGroup:insert(sizePicker) sizePicker.tap = sineBarSize sizePicker:addEventListener ( "tap", sizePicker )