iOS Question need help with the Picker view

ilan

Expert
Licensed User
Longtime User
i have a list and i would like to add the list to the picker
how do i do it?

list has 5 items (item1, item2,...)
i want to show them on the picker but get error:


i have seen the example of CoordinatesCalc where the picker is used but cannot understand how to do it...
 

ilan

Expert
Licensed User
Longtime User
really weird, if i add the list1 to the picker in Application_Start it works fine but if i add the list to the piccker in a Button click event it shows the error i have posted above...

why?? is it not possible to set the items in a button_click event?
 
Upvote 0

tuhatinhvn

Active Member
Licensed User
Longtime User
B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'Public variables can be accessed from all modules.
    Public App As Application
    Public NavControl As NavigationController
    Private Page1 As Page
    Private spnday As Picker
End Sub

B4X:
Private Sub Application_Start (Nav As NavigationController)
    NavControl = Nav
    Page1.Initialize("Page1")
    Page1.Title = "Page 1"
    Page1.RootPanel.Color = Colors.White
    Page1.RootPanel.LoadLayout("thu") 'layout thu is mine, you can use designer and save with other name
    NavControl.ShowPage(Page1)
    NavControl.ToolBarVisible=False
    NavControl.NavigationBarVisible=False
Dim daylist As List
daylist.Initialize
For i=1 To 31
daylist.Add(i)
Next
spnday.SetItems(0,daylist)
End Sub
 
Last edited:
Upvote 0

ilan

Expert
Licensed User
Longtime User
i did it like this see here but why i cannot add items to the picker via a Button_click event only on Application_Start
 
Last edited:
Upvote 0

ilan

Expert
Licensed User
Longtime User
ok erel i will send you my project file when i get home, maybe its because i am using ios7.1.2 (iphone 4)

if you try to set the picker items from an button it works for you?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…