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

klaus

Expert
Licensed 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
 

davepamn

Active Member
Licensed User
I am looking for the equivalent function to "FindByValue"
 
Last edited:

davepamn

Active Member
Licensed 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
 

davepamn

Active Member
Licensed 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:
Top