iOS Question [RESOLVED] CSBuilder

MarcoRome

Expert
Licensed User
Longtime User
Hi all. Happen a strain thing with csbuilder.
If i have this code:
B4X:
    Dim cs As CSBuilder
    cs.Initialize.Font(Font.CreateFontAwesome(20))
    cs.Color(Colors.Red).Append("Titolo ").Append(CRLF).Pop
    cs.Append("Categoria: Calcio").Append(CRLF)
    cs.Append("Visualizzazioni: 456").Append(CRLF)
    cs.Append("Stelle: ").Font(Font.CreateFontAwesome(20)).Color(Colors.Red).Append(Chr(0xF005))
    cs.PopAll

i have this result:

20180104_202150.jpg


if i have this code ( that seem correct code ) :

B4X:
    Dim cs As CSBuilder
    cs.Initialize.Color(Colors.Red).Append("Titolo ").Append(CRLF).Pop
    cs.Append("Categoria: Calcio").Append(CRLF)
    cs.Append("Visualizzazioni: 456").Append(CRLF)
    cs.Append("Stelle: ").Font(Font.CreateFontAwesome(20)).Color(Colors.Red).Append(Chr(0xF005))
    cs.PopAll

i have this result:
20180104_202310.jpg


So i see FontAwesome only if i insert in first line. In this way i cant add new font or new style( type bold etc ) . Where i wrong ?
Thank you
Marco
 

tufanv

Expert
Licensed User
Longtime User
Hi all. Happen a strain thing with csbuilder.
If i have this code:
B4X:
    Dim cs As CSBuilder
    cs.Initialize.Font(Font.CreateFontAwesome(20))
    cs.Color(Colors.Red).Append("Titolo ").Append(CRLF).Pop
    cs.Append("Categoria: Calcio").Append(CRLF)
    cs.Append("Visualizzazioni: 456").Append(CRLF)
    cs.Append("Stelle: ").Font(Font.CreateFontAwesome(20)).Color(Colors.Red).Append(Chr(0xF005))
    cs.PopAll

i have this result:

View attachment 63422

if i have this code ( that seem correct code ) :

B4X:
    Dim cs As CSBuilder
    cs.Initialize.Color(Colors.Red).Append("Titolo ").Append(CRLF).Pop
    cs.Append("Categoria: Calcio").Append(CRLF)
    cs.Append("Visualizzazioni: 456").Append(CRLF)
    cs.Append("Stelle: ").Font(Font.CreateFontAwesome(20)).Color(Colors.Red).Append(Chr(0xF005))
    cs.PopAll

i have this result:
View attachment 63423

So i see FontAwesome only if i insert in first line. In this way i cant add new font or new style( type bold etc ) . Where i wrong ?
Thank you
Marco
It is probably you are not popping the non-fontawesome lines before switching to font awesome:
close all lines before switching to fontawesome with .pop
:
 
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
Thank you for your answer. But in 2 and 3 lines i cant add pop

B4X:
Dim cs As CSBuilder
    cs.Initialize.Color(Colors.Red).Append("Titolo ").Append(CRLF).Pop
    cs.Append("Categoria: Calcio").Append(CRLF)  '<----- No pop
    cs.Append("Visualizzazioni: 456").Append(CRLF) '<---- No pop
    cs.Append("Stelle: ").Font(Font.CreateFontAwesome(20)).Color(Colors.Red).Append(Chr(0xF005))
    cs.PopAll

If i add pop in 2 and 3 lines it crashes
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
Thank you for your answer. But in 2 and 3 lines i cant add pop

B4X:
Dim cs As CSBuilder
    cs.Initialize.Color(Colors.Red).Append("Titolo ").Append(CRLF).Pop
    cs.Append("Categoria: Calcio").Append(CRLF)  '<----- No pop
    cs.Append("Visualizzazioni: 456").Append(CRLF) '<---- No pop
    cs.Append("Stelle: ").Font(Font.CreateFontAwesome(20)).Color(Colors.Red).Append(Chr(0xF005))
    cs.PopAll

If i add pop in 2 and 3 lines it crashes
try to change according to your need . this works for me in my app : it is very similar to your need.

B4X:
cs.Font(Font.CreateNew2("TitilliumWeb-Regular",22)).Color(Colors.white).VerticalAlign(1).Append("Total : ").Pop
                cs.Font(Font.CreateNew2("TitilliumWeb-SemiBold",22)).Color(Colors.white).VerticalAlign(1).Append("$ " & NumberFormat(globaltoplam    ,0,2) & " | " ).Pop
                cs.Font(Font.CreateFontAwesome(27)).Color(Colors.RGB(255,105,0)).Append("").Pop
                cs.Font(Font.CreateNew2("TitilliumWeb-SemiBold",22)).color(Colors.white).VerticalAlign(1).Append(" " &NumberFormat2(globaltoplam/binancebtc    ,1,4,1,True) ).Pop
                cs.PopAll
 
Upvote 0
Top