iOS Question Picker Problem

Giuliano Cucchiarini

Member
Licensed User
Longtime User
Hi, I am moving the first steps with B4i.
I found a problem with the Picker. When I load Items on it using a list of string I do not see anything, the Picker is always empty. I initialized the list and the Picker, but nothing.
Here my very simple code:


'Code module
#Region Project Attributes
#ApplicationLabel: B4i Example
#Version: 1.0.0
'Orientation possible values: Portrait, LandscapeLeft, LandscapeRight and PortraitUpsideDown
#iPhoneOrientations: Portrait, LandscapeLeft, LandscapeRight
#iPadOrientations: Portrait, LandscapeLeft, LandscapeRight, PortraitUpsideDown
#End Region

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 Picker1 As Picker
End Sub

Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Page1.Initialize("Page1")
Page1.Title = "Page 1"
Page1.RootPanel.LoadLayout("L1")
Page1.RootPanel.Color = Colors.White
NavControl.ShowPage(Page1)

'
Picker1.Initialize("Picker1")

Dim myList As List
myList.Initialize

myList.Add("A")
myList.Add("B")
myList.Add("C")

Picker1.SetItems(0,myList)

End Sub

Private Sub Page1_Resize(Width As Int, Height As Int)

End Sub

Private Sub Application_Background

End Sub

'----

Thank you for your help
Giuliano C.
 

schimanski

Well-Known Member
Licensed User
Longtime User
Did you add the picker in the layout? if yes, you don't need to initialize it. If no, you need to add the picker to page1 with page1.rootpanel.addview...
 
Upvote 0

Giuliano Cucchiarini

Member
Licensed User
Longtime User
Thank you for your reply.
Yes I added the picker with the designer, and I see it when I run the program...
(The only problems is that I do not see the items)

If I remove the instruction: Picker1.Initialize("Picker1") the programs works well and I see
the items...

Thank you again for your suggestion.

Giuliano C.
 
Upvote 0
Top