Android Code Snippet Tip: CSBuilder usage

A small point about CSBuilder.
You cannot mix CSBuilder objects with 'standard' text because the formatting will be lost.
This works as expected:
B4X:
    cs.Initialize.Append("Hello ")
    cs.Color(Colors.Blue).Append("world!").Pop
    lbl.Text = cs
but this removes all formatting:
B4X:
    cs.Initialize.Append("Hello ")
    cs.Color(Colors.Blue).Append("world!").Pop
    lbl.Text = cs & " "
 

Mahares

Expert
Licensed User
Longtime User
You cannot mix CSBuilder objects with 'standard' text because the formatting will be lost.
If you want to preserve the formatting, simply do this: cs=cs.Append(" ") instead of this: lbl.Text = cs & " "
B4X:
cs.Initialize.Append("Hello ")
    cs.Color(Colors.Blue).Append("world!").Pop
    lbl.Text = cs=cs.Append(" ")
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…