iOS Question How do I select an item in a data picker

klaus

Expert
Licensed User
Longtime User
You need to be more precise on what exactly you want or need.
Did you read the documentaion ?
Did you do already some tests ?
Do you know these two applications which allows you to display the library help files ?
B4x ObjectBrowser
B4x Help Viewer
 
Upvote 0

davepamn

Active Member
Licensed User
Longtime User
How do I get the tag for the data picker item when data picker item is set using an AttributeString?

The list type has a tag attribute, but I need the tag for a list item
 
Upvote 0

davepamn

Active Member
Licensed User
Longtime User
B4X:
    Dim oFont AsFont
    Dim oKeyValue AsAttributedString
    oFont=Font.CreateNew(30)

     oKeyValue.Initialize(sListText,oFont, Colors.Black)
     oKeyValue.Tag=sListValue
     myList.Add(oKeyValue)

      oLBX.SetItems(0,myList)
      oLBX.SelectRow(0,FindByValueWithAttributeString(oLBX,0,sSelectedValue),True)

Sub FindByValueWithAttributeString(pick As Picker, column As Int, value As String) As Int
  Dim items As List = pick.GetItems(column)
  For i = 0 To items.Size - 1
        Dim attr As AttributedString = pick.GetItems(column).Get(i)
        If value = attr.tag Then Return i
  Next
  Return -1
End Sub

Great! This worked

If you could create a dynamic date picker type, it would be helpful
 
Last edited:
Upvote 0
Top