How to get date from pickerWheel

Hi all,

I need some help.

I am using a pickerwheel in my app to allow people to pick dates. Now I need it so that when they pick a date, it a appears onscreen in like a textbox, or something else.

For example, if you look at the calendar app in iOS, you can pick a date with the picker wheel. When you pick a date it appears onscreen.

This is what I need.

Here is my code:

 --Date Picker  
  
 local function onButtonRelease( event )  
 -- set up the pickerWheel's columns  
 local columnData = {}  
 columnData[1] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }  
 columnData[1].alignment = "right"  
 columnData[1].width = 150  
 columnData[1].startIndex = monthIndex or 10  
  
 columnData[2] = {}  
 for i=1,31 do  
 columnData[2][i] = i  
 end  
 columnData[2].alignment = "center"  
 columnData[2].width = 60  
 columnData[2].startIndex = dayIndex or 25  
  
 columnData[3] = {}  
 for i=1,25 do  
 columnData[3][i] = i+2011  
 end  
 columnData[3].startIndex = yearIndex or 1  
  
 -- create pickerWheel widget  
 local picker = widget.newPickerWheel{  
 top=970,  
 font=native.systemFontBold,  
 columns=columnData,  
 }  
  
 -- onComplete listener for pickerWheel "slide up" transition  
 local function showDoneButton()  
  
 local function onDoneRelease( event )  
 -- extract selected rows from pickerWheel columns  
 local pickerValues = picker:getValues()  
 monthIndex = pickerValues[1].index  
 dayIndex = pickerValues[2].index  
 yearIndex = pickerValues[3].index  
  
 print( "Chosen date: " .. pickerValues[1].value .. " " .. pickerValues[2].value .. ", " .. pickerValues[3].value )  
  
 display.remove( picker )  
 picker = nil  
  
 display.remove( doneButton )  
 doneButton = nil  
 end  
  
 -- button below is local because of forward declaration defined earlier  
 doneButton = widget.newButton{  
 default = "Images/donebtn.png",  
 over = "Images/donebtn\_over.png",  
 width = 104,  
 height = 50,  
 left = 500,  
 top = 75,  
 onRelease = onDoneRelease  
 }  
 end  
  
 -- slider pickerWheel up into view  
 transition.to( picker, { time=800, y=740, transition=easing.inOutExpo, onComplete=showDoneButton } )  
 end  
  
 -- create button widget to show pickerWheel  
 local button = widget.newButton{  
 label = "Show Picker",  
 onRelease = onButtonRelease  
 }  
 group:insert( button )  
 button.x = 160  
 button.y = 300  

Thanks in advance!
-Landon [import]uid: 111492 topic_id: 31483 reply_id: 331483[/import]