#Region Project Attributes
#ApplicationLabel: AndroidSpinnerWheel
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: landscape
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private vsw1, vsw2 As WheelVerticalView
Private hsw1 As WheelHorizontalView
Dim months() As String
Dim cities() As String
Dim numbers() As String
Dim countries(), countries1() As String
Private vsw3, vsw4 As WheelVerticalImageView
Dim loadFromList As Boolean = True 'if TRUE then it will load from the /drawable folder
'if FALSE it will use the list containing bitmaps
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("main")
vsw1.ItemDimmedAlpha = 100
vsw1.SpinnerTextColor = Colors.Red
vsw1.SpinnerTextSize = 15
months = Array As String("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")
vsw1.SpinnerItems = months
vsw1.setupSpinnerWheel
vsw1.SelectedIndex = 6
vsw2.ItemDimmedAlpha = 150
vsw2.SpinnerTextColor = Colors.Yellow
vsw2.SpinnerTextSize = 15
cities = Array As String("New York", "Washington", "Chicago", "Atlanta", "Orlando", "Los Angeles", "Houston", "New Orleans")
vsw2.SpinnerItems = cities
vsw2.setupSpinnerWheel
vsw2.SelectedIndex = 3
hsw1.ItemDimmedAlpha = 70
hsw1.SpinnerTextColor = Colors.Green
hsw1.SpinnerTextSize = 15
numbers = Array As String(" 01 ", " 02 ", " 03 ", " 04 ", " 05 ", " 06 ", " 07 ", " 08 ", " 09 ", " 10 ", " 11 ", " 12 ")
hsw1.SpinnerItems = numbers
hsw1.setupSpinnerWheel
hsw1.SelectedIndex = 7
countries = Array As String(" USA ", " Canada ", " Ukraine ", " France ", " South Africa ", " Germany ", " Scotland ", " United Kingdom ", " Russia ", " Israel ", " Brazil ", " Ireland ", " China ")
'The following array is populated with the names of the image files in the /Object/res/drawable folder
'It must have the same number of elements as the "countries" array in the above statement
vsw3.Images = Array As String("usa","canada", "ukraine", "france", "southafrica", "germany", "scotland", "unitedkingdom", "russia", "israel", "brazil", "ireland", "china")
vsw3.SpinnerItems = countries
vsw3.SpinnerTextColor = Colors.Cyan
vsw3.SpinnerTextSize = 20
vsw3.setupSpinnerWheel
vsw3.SelectedIndex = 2
Dim mylist As List
mylist.Initialize
mylist.Add(LoadBitmap(File.DirAssets,"brazil.png")) 'add bitmaps to the list. They can come from anywhere
mylist.Add(LoadBitmap(File.DirAssets,"canada.png"))
mylist.Add(LoadBitmap(File.DirAssets,"france.png"))
mylist.Add(LoadBitmap(File.DirAssets,"germany.png"))
mylist.Add(LoadBitmap(File.DirAssets,"usa.png"))
vsw4.ImageFromList = loadFromList
If loadFromList Then
countries1 = Array As String(" Brazil ", " Canada ", " France ", " Germany ", " USA ")
vsw4.SpinnerItems = countries1
vsw4.ImageBitmaps = mylist
Else
vsw4.SpinnerItems = countries
vsw4.Images = Array As String("usa","canada", "ukraine", "france", "southafrica", "germany", "scotland", "unitedkingdom", "russia", "israel", "brazil", "ireland", "china")
End If
vsw4.SpinnerTextColor = Colors.Magenta
vsw4.SpinnerTextSize = 20
vsw4.setupSpinnerWheel
vsw4.SelectedIndex = 2
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub vsw1_value_changed(index As Int)
Log("Selected Month = " & months(index))
End Sub
Sub vsw2_value_changed(index As Int)
Log("Selected City = " & cities(index))
End Sub
Sub hsw1_value_changed(index As Int)
Log("Selected Number = " & numbers(index))
End Sub
Sub vsw3_value_changed(index As Int)
Log("Selected Country = " & countries(index))
End Sub
Sub vsw4_value_changed(index As Int)
If loadFromList Then
Log("Selected Country = " & countries1(index))
Else
Log("Selected Country = " & countries(index))
End If
End Sub