iOS Question Select item

ivanomonti

Expert
Licensed User
Longtime User
Hi,

how can I retrieve the selected value in the Picker!!!

Thank
 

inakigarm

Well-Known Member
Licensed User
Longtime User
Do you want to select the ítem when at picker's event Click or when clicking another view (button,etc..)

First case you have to get the selecteditem at picker_click event; otherwise with picker.getselecteditem

(I have no computer to test it now)
 
Upvote 0

ivanomonti

Expert
Licensed User
Longtime User
hi


B4X:
Sub Picker_click

    Dim p As Picker = Sender
  
    Msgbox( p.GetSelectedItem(?)), "PICKER" )

end sub

not returns an index and a value ... maybe something is missing
 
Upvote 0

inakigarm

Well-Known Member
Licensed User
Longtime User
See coordinates example: (Not Click Event but ItemSelected Event)

B4X:
Dim Picker1 as Picker
Dim pickerItems As List
Dim data As List = su.LoadCSV(File.DirAssets, "datums.csv", ",")
PickerItems.Initialize
    For Each S() As String In data
        Dim d As Datum
        d.Initialize
        d.f = 1 / S(1)
        d.A = S(2)
        d.dx = S(3)
        d.dy = S(4)
        d.dz = S(5)
        DatumData.Put(S(0), d)
        pickerItems.Add(S(0))
    Next
Picker1.SetItems(0, pickerItems)  'Fill Picker

Sub Picker1_ItemSelected (Column As Int, Row As Int) 'Get Selected Item
    Dim datumName As String = Picker1.GetItems(Column).Get(Row)
    selectedDatum = DatumData.Get(datumName)
    AfterChange
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…