PickerWheel Problems

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:

  1. On the first “Tap” the wheel automatically moves to select the last row returns NIL, but doesn’t crash.

  2. 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 )

If you remove the event listener on the pickerWheel does it seem to work properly?  Normally, when I use the pickerwheel, I have an action button elsewhere.  I’ve never seen a pickerwheel serve as a selection tool and the action object.  In other words, could the fact that you have a tap listener on the pickerwheel be the problem?

Hi @spowell83,

As @vanheuverswyn says, a PickerWheel isn’t really meant to be “tapped” itself… instead, a button or other process should trigger selection/use of the data that the user selects inside the PickerWheel columns.

Brent

If you remove the event listener on the pickerWheel does it seem to work properly?  Normally, when I use the pickerwheel, I have an action button elsewhere.  I’ve never seen a pickerwheel serve as a selection tool and the action object.  In other words, could the fact that you have a tap listener on the pickerwheel be the problem?

Hi @spowell83,

As @vanheuverswyn says, a PickerWheel isn’t really meant to be “tapped” itself… instead, a button or other process should trigger selection/use of the data that the user selects inside the PickerWheel columns.

Brent

Old topic, but new problem for me – what I’d like to see is the PickerWheel generate an event when all columns come to rest. That way you could get the values without the user having to do anything else.

 Jay

I agree. We need to know when it has come to rest.

Yes, i would second this.

I am also having problems, whereby the values returned from Pickerwheel is ‘nil’ when the wheel is still spinning.

I would recommend that the returned value would just be the closest value, instead of nil

Edit : I just saw this issue of ‘nil’ returned has been addressed in a daily-corona build (Fixed a bug in the pickerWheel where by a fast scroll, a nil value was returned. Casenum 23290)

Old topic, but new problem for me – what I’d like to see is the PickerWheel generate an event when all columns come to rest. That way you could get the values without the user having to do anything else.

 Jay

I agree. We need to know when it has come to rest.

Yes, i would second this.

I am also having problems, whereby the values returned from Pickerwheel is ‘nil’ when the wheel is still spinning.

I would recommend that the returned value would just be the closest value, instead of nil

Edit : I just saw this issue of ‘nil’ returned has been addressed in a daily-corona build (Fixed a bug in the pickerWheel where by a fast scroll, a nil value was returned. Casenum 23290)