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: Copy
    cs.Initialize.Append("Hello ")
    cs.Color(Colors.Blue).Append("world!").Pop
    lbl.Text = cs
but this removes all formatting:
B4X: Copy
    cs.Initialize.Append("Hello ")
    cs.Color(Colors.Blue).Append("world!").Pop
    lbl.Text = cs & " "
 
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 & " "
Code: Copy
cs.Initialize.Append("Hello ")
    cs.Color(Colors.Blue).Append("world!").Pop
    lbl.Text = cs=cs.Append(" ")
 
Back
Top