Please add this feature to the picker widget!

It would be great if the picker automatically had a Cancel and Done button, with the values from the picker being returned into a table when the user taps the done button. Sure would save a lot of time for the developer in coding pickers! In the meantime, I’ve created a similar look using the code below. You can quickly see how much time having Corona do this for me would save for each picker I have to create (I have a screen which uses 4 different pickers!)

[lua]local toolbarGradient = graphics.newGradient( {168, 181, 198, 255 }, {139, 157, 180, 255}, “down” )

– create the actual picker widget with column data
yearPicker = widget.newPickerWheel{
id=“yearPicker”,
font=“Helvetica-Bold”,
top=258,
columns=years
}

– Create the toolbar ui to go above the picker.
pickerBar = display.newRect(0,yearPicker.y - 44, display.viewableContentWidth, 44)
pickerBar.strokeWidth = 1
pickerBar:setStrokeColor(0,0,0, 255)
pickerBar:setFillColor(toolbarGradient)

– Add Cancel Button
cancelButton = widget.newButton{
id = “bCancel”,
style = “blue1Small”,
label = “Cancel”,
onRelease = onButtonRelease
}
cancelButton.x = 35
cancelButton.y = pickerBar.y

– Add Done Button
doneButton = widget.newButton{
id = “bDone”,
style = “blue2Small”,
label = “Done”,
onRelease = onButtonRelease
}
doneButton.x = display.viewableContentWidth - 35
doneButton.y = pickerBar.y [/lua] [import]uid: 64538 topic_id: 33291 reply_id: 333291[/import]

+1 [import]uid: 30847 topic_id: 33291 reply_id: 133084[/import]

Code Exchange… [import]uid: 8271 topic_id: 33291 reply_id: 133087[/import]

Thanks Matt!
…I’ve get the code from the exchange.

I’m wondering also if there’s a way to have an event callback in the PickerWheel widget when the wheel list is moved.
Actually you can only call picker:getValues() after you have moved the list to get the selected item.
But I think that it is not feasible!!!

Ale [import]uid: 30847 topic_id: 33291 reply_id: 133231[/import]

I don’t think it is either. I’ve tried adding a touch listener to the picker so that the user wouldn’t have to touch a done button for a single picker like the year one listed above, but I never could get it to work. I thought it might be nice if the user could simply select the appropriate year and be done with it, and then upon reflection, I realized it was a really bad idea from a UX perspective. [import]uid: 64538 topic_id: 33291 reply_id: 133233[/import]

+1 [import]uid: 30847 topic_id: 33291 reply_id: 133084[/import]

Code Exchange… [import]uid: 8271 topic_id: 33291 reply_id: 133087[/import]

Thanks Matt!
…I’ve get the code from the exchange.

I’m wondering also if there’s a way to have an event callback in the PickerWheel widget when the wheel list is moved.
Actually you can only call picker:getValues() after you have moved the list to get the selected item.
But I think that it is not feasible!!!

Ale [import]uid: 30847 topic_id: 33291 reply_id: 133231[/import]

I don’t think it is either. I’ve tried adding a touch listener to the picker so that the user wouldn’t have to touch a done button for a single picker like the year one listed above, but I never could get it to work. I thought it might be nice if the user could simply select the appropriate year and be done with it, and then upon reflection, I realized it was a really bad idea from a UX perspective. [import]uid: 64538 topic_id: 33291 reply_id: 133233[/import]