Hi folks!!
Maybe on of you has tried to do this.
I’m developing a game and I need to show some information in the same way that the iphone display the set time when the user wants to set this. I want to display a list of items vertically and be able to move (up and down) the list, the same way that I do this in the iphone when I change the hours. How can I do this?, How can I know wich is the item selected? (the item that is showed in the middle).
Thanks in advance. [import]uid: 54055 topic_id: 14671 reply_id: 314671[/import]
Open CoronaSDK in Applications, then go SampleCode > Interface > WidgetDemo.
Once you’re running that click on “NewPickerWheel” (It’s an option inside the app).
That’s a great example of how to do what you’re asking [import]uid: 52491 topic_id: 14671 reply_id: 54264[/import]
Hi!!!
thanks for response!!
But I have a problem, I don’t have that example in my examples folder, could you have some link or file to send me and see how this is done?.
thanks in advance.
[import]uid: 54055 topic_id: 14671 reply_id: 54286[/import]
Hi Peach!!
I was searching some code and I found this, is an entire code but doesn’t work. Could you tell me what is wrong?
thanks in advance.
[lua]–widget.newPickerWheel( [params] )
– localize a couple variables prior to use
local myPicker, doneButton
– button event handler
local onDone = function( event )
– get values from picker wheel
local m = myPicker.col1.value
local d = myPicker.col2.value
local y = myPicker.col3.value
– Print the results to the terminal:
print( m … " " … d … ", " … y )
– remove the button
display.remove( doneButton )
doneButton = nil
– remove the picker wheel
display.remove( myPicker )
myPicker = nil
end
– Create the picker widget:
myPicker = widget.newPickerWheel{ preset=“usDate”, startDay=19, startMonth=2, startYear=2011 }
– Place picker wheel at bottom of iPhone screen:
–myPicker.y = display.contentHeight - myPicker.height
– Create a “Done” ui button widget to capture picker selection:
doneButton = widget.newButton{ label=“Done”, onRelease=onDone }
doneButton:setReferencePoint( display.CenterRightReferencePoint )
doneButton.x = display.contentWidth - 5
doneButton.y = 22
local pickerColumn = {
data = {“Item #1”,“Item #2”,“Item #3”,“Item #4”,“Item #5”,“Item #6”,“Item #7”,“Item #8”,“Item #10”},width = 100
}
local someGroup = display.newGroup()
local myPicker = widget.newPickerWheel{ preset=“usDate” }
– WRONG:
someGroup:insert( myPicker ) --> will produce an error
– CORRECT:
someGroup:insert( myPicker.view )
print( myPicker.col1.value )
print( myPicker.col2.value )
print( myPicker.col3.value )
myPicker:removeSelf()
myPicker = nil
– or
display.remove( myPicker )
myPicker = nil
myPicker:removeSelf()
myPicker = nil
– or
display.remove( myPicker )
myPicker = nil[/lua] [import]uid: 54055 topic_id: 14671 reply_id: 54309[/import]
What version of Corona are you currently running?
You may need to update. [import]uid: 52491 topic_id: 14671 reply_id: 54382[/import]
Hi!!
I opened de Ansca simulator and I found:
Ansca Corona Simulator
2011.484 (2011.4.12)
Is that the information you need?
Thanks [import]uid: 54055 topic_id: 14671 reply_id: 54406[/import]
Hi peach!!
I downloaded de last version, so now I have that example.
This example just run over iphone?, can I run that example on simulator (notebook windows), because in my computer doesn’t work.
Thanks.
Kind regards. [import]uid: 54055 topic_id: 14671 reply_id: 54449[/import]
Hey again,
Yes, at the present time I believe widgets are only for iOS.
You may want to look at creating your own visual elements to replicate it on Android?
Peach [import]uid: 52491 topic_id: 14671 reply_id: 54515[/import]
Hi peach!!
I have trying to make the same effect with a list, using the listview example, it is almost the same, but I cant make the list thinner or smaller?, because just one list it is showed on the entire screen.
Thanks. [import]uid: 54055 topic_id: 14671 reply_id: 54552[/import]
For UI related stuff you should post in the UI forum. (It means others looking for the same things can read your posts :))
Check out second post here; http://developer.anscamobile.com/forum/2011/07/28/creating-list-view-multiple-columns
[import]uid: 52491 topic_id: 14671 reply_id: 54697[/import]