67biscuits
Member
It seems a newby's problem, but I am hoping that someone can shove me in the right direction. I have figured out how to make a three spinner object and placed it successfully in a panel. The objects are spinners from which the date segments are selected. How do I catch the click/selection from the said spinners?
Also, wondering how can economize the code a little further with the "filler" list. I can't seem to make it work thus its rem'd out. Any suggestions? It probably has something to do with lists vs arrays, which keep tripping me up, albeit less so now that before.
cheers all
Charley
Also, wondering how can economize the code a little further with the "filler" list. I can't seem to make it work thus its rem'd out. Any suggestions? It probably has something to do with lists vs arrays, which keep tripping me up, albeit less so now that before.
cheers all
Charley
Sub Create_grid(p As Panel, r As Int, c As Int) Dim days() As Int = Array As Int(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) Dim months() As String = Array As String("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec") Dim years() As Int = Array As Int( DateTime.GetYear(DateTime.Now), DateTime.GetYear(DateTime.Now) + 1, DateTime.GetYear(DateTime.Now) + 2) 'Dim filler As List = Array As List (days,months,years) 'either lists or direct data make no diff Dim s As Spinner For row = 0 To r-1 For col = 0 To c - 1 s.Initialize("s") p.AddView(s, p.Width / 3 * col, 0, p.Width / 3, 100) 's.AddAll(filler.get(col)) 'it yacks here If col = 0 Then s.AddAll(days) If col = 1 Then s.addall(months) If col = 2 Then s.AddAll(years) 'how to set primary selection to current date Next Next 's.initialize("s") 'p.AddView(s, 0, 0, p.Width / 3, p.Width / 3) 's.AddAll(days) 's.selectedindex = DateTime.GetDayOfMonth(DateTime.now) ' 's.initialize("s") 'p.AddView(s, p.Width / 3, 0, p.Width / 3, p.Width / 3) 's.AddAll(months) 's.SelectedIndex = DateTime.GetMonth(DateTime.Now) ' 's.Initialize("s") 'p.AddView(s, (p.Width / 3)* 2, 0, p.Width / 3, p.Width / 3) 's.AddAll(years) 's.SelectedIndex = DateTime.GetDayOfYear(DateTime.Now) ' End Sub:
Sub Create_grid(p As Panel, r As Int, c As Int)
Dim days() As Int = Array As Int(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)
Dim months() As String = Array As String("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec")
Dim years() As Int = Array As Int( DateTime.GetYear(DateTime.Now), DateTime.GetYear(DateTime.Now) + 1, DateTime.GetYear(DateTime.Now) + 2)
' Dim filler As List = Array As List (days,months,years) 'either lists or direct data make no diff
Dim s As Spinner
For row = 0 To r-1
For col = 0 To c - 1
s.Initialize("s")
p.AddView(s, p.Width / 3 * col, 0, p.Width / 3, 100)
' s.AddAll(filler.get(col)) 'it yacks here
If col = 0 Then s.AddAll(days)
If col = 1 Then s.addall(months)
If col = 2 Then s.AddAll(years)
'how to set primary selection to current date
Next
Next
' s.initialize("s")
' p.AddView(s, 0, 0, p.Width / 3, p.Width / 3)
' s.AddAll(days)
' s.selectedindex = DateTime.GetDayOfMonth(DateTime.now)
'
' s.initialize("s")
' p.AddView(s, p.Width / 3, 0, p.Width / 3, p.Width / 3)
' s.AddAll(months)
' s.SelectedIndex = DateTime.GetMonth(DateTime.Now)
'
' s.Initialize("s")
' p.AddView(s, (p.Width / 3)* 2, 0, p.Width / 3, p.Width / 3)
' s.AddAll(years)
' s.SelectedIndex = DateTime.GetDayOfYear(DateTime.Now)
'
End Sub