A small, cross platform, example of using the new anchors feature of BBCodeView.
It reads a CSV file with information about US politicians. The data is used to populate a BBCodeView and B4XDialog+B4XSearchTemplate.
The bbcode looks like:
B4X:
For Each pol As Politician In politicians
sb.Append($"
[a="${pol.Name}"][b][TextSize=18]${pol.Name}[/TextSize][/b][/a]
Twitter: [url]@${pol.TwitterUserName}[/url]
Birthday: $Date{pol.Birthday}
${pol.Party}
"$)
Next
The anchors are used in this code:
B4X:
Private Sub btnJumpTo_Click
Wait For (dialog.ShowTemplate(SearchTemplate, "", "", "Cancel")) Complete (result As Int)
If result = xui.DialogResponse_Positive Then
BBCodeView1.ScrollToAnchor(SearchTemplate.SelectedItem)
End If
End Sub
The generated bbcode text can get quite large. I wouldn't use BBCodeView like this with a larger dataset.
Attachments
Last edited: