Android Question Concatenating CSBuilders

aedwall

Active Member
Licensed User
Longtime User
I create a cs1 object using CSBuilder and then display it in an EditText control. I see color.

I create a cs2 object using CSBuilder and then display it in an EditText control. I see color.

But when I try to combine the two into one, I lose my color.

Neither of these work:

EditText1.Text = cs1 & cs2 '(probably because the cs objects are converted to regular strings, like cs1.ToString, and I lose my colors)

nor

EditText1.Text = cs1
EditText1.Text = EditText1.Text & cs2

How can I join cs1 and cs2 without losing my colors?

Thank you.

Here is sample code (where all color is lost):

Dim cs1, cs2 As CSBuilder

cs1.Initialize
cs1.Color(Colors.Red).Bold.Append("Red+Bold ")
cs1.Pop ' remove bold
cs1.Color(Colors.Green) 'this hides the red color
cs1.Append("Green ")
cs1.Pop ' remove green and reveals the red
cs1.Append("Red ")
cs1.Pop ' remove red which was the only remaining span
cs1.Append("Plain text")

EditText1.Text = cs1 & CRLF

cs2.Initialize
cs2.Color(Colors.Red).Bold.Append("cs2 - Red+Bold ")
cs2.Pop ' remove bold
cs2.Color(Colors.Green) 'this hides the red color
cs2.Append("cs2 - Green ")

cs2.Pop ' remove green and reveals the red
cs2.Append("cs2 - Red ")
cs2.Pop ' remove red which was the only remaining span
cs2.Append("cs2 - Plain text")

'EditText1.Text = cs1 & cs2
EditText1.Text = EditText1.Text & cs2

Apparent SOLUTION:

cs3.Initialize

cs3.Append(cs1).Append(CRLF).Append(cs2)

EditText1.Text = cs3
 
Last edited:
Top