I use BBCodeView to make every letter in a text clickable, if the user clicks one letter it will become red.
dim question as string = "DENZEL WASHINGTON"
Dim s As String = "[font=Unispace][Alignment=Center][TextSize=50]"
For i=0 To question.Length-1
Dim letter As String = question.CharAt(i)
If letter=" " Then
s = s & letter$
Continue
End If
Dim m As Map = LettersList.Get(i)
If m.Get("clicked") Then
s = s & $"[url="${i}"][color=red]${letter}[/color][/url]"$
Else
s = s & $"[url="${i}"][color=green]${letter}[/color][/url]"$
End If
Next
s=s& "[/TextSize][/Alignment][/font]"
Sentence.Text=s
this is the output:
[font=Unispace][Alignment=Center][TextSize=50] [url="0"][color=green]D[/color][/url][url="1"][color=green]E[/color][/url][url="2"][color=green]N[/color][/url][url="3"][color=green]Z[/color][/url][url="4"][color=green]E[/color][/url][url="5"][color=green]L[/color][/url][url=""][color=white] [/color][/url][url="7"][color=green]W[/color][/url][url="8"][color=green]A[/color][/url][url="9"][color=green]S[/color][/url][url="10"][color=green]H[/color][/url][url="11"][color=green]I[/color][/url][url="12"][color=green]N[/color][/url][url="13"][color=green]G[/color][/url][url="14"][color=green]T[/color][/url][url="15"][color=green]O[/color][/url][url="16"][color=green]N[/color][/url][/TextSize][/Alignment][/font]
In contrast to a label, there are some design flaws.
- Linebreaks will not remove the spaces, so the word isnt centered anymore.
- the gaps between the letters are smaller.
- if the word doesnt fit in one line, it will not break. So it will be cut left and right.
i used CS builder before and this worked perfectly, unfortunaly it doesnt work with B4I. So i want to use BBCodeView as crossplatform solution.
is there any way to fix the problems mentioned above?