How to duplicate the iphone set time display?

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.

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 :)

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.

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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
--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

What version of Corona are you currently running?

You may need to update.

Hi!!
I opened de Ansca simulator and I found:
Ansca Corona Simulator
2011.484 (2011.4.12)

Is that the information you need?

Thanks

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.

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 :)

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.

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

:)

views:1654 update:2011/10/4 17:12:07
corona forums © 2003-2011