Android Question BBCodeView1 / line break problems [solved]

FrankDev

Active Member
Licensed User
Longtime User
Hello

I use the following code with its own font. I always have the problem if I use a continuous text (without line break) and it breaks in the wrong place.
It usually writes a word that is no longer completely displayed in the line. (see picture - where BBCodeView1 is on a white background).
BBCodeView1 ends where it is cut off.
See picture.

regards Frank

B4X:
TextEngine.Initialize(Activity)
TextEngine.TagParser.UrlColor = xui.Color_White
           
BBCodeView1.ParseData.DefaultFont = xui.CreateFont(myFont,14)
BBCodeView1.Text = Text


Screenshot_2020-05-20.jpg
 
Last edited:

FrankDev

Active Member
Licensed User
Longtime User
Hello,

I think I see the problem. I'm downloading the texts from a website. The control will probably be resized after the text has been transferred. The text is not reformatted again (as I thought)
The example shows the 'problem'
 

Attachments

  • bbcv1.zip
    468.6 KB · Views: 177
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. Use File - Export as zip when uploading projects.
2. Correct code:
B4X:
Sub Button1_Click
    BBCodeView1.mBase.Width = BBCodeView1.mBase.Width - 20dip
    If xui.IsB4A Then
        BBCodeView1.Base_Resize(BBCodeView1.mBase.Width, BBCodeView1.mBase.Height)
    End If
End Sub
It is only needed in B4A as it will happen automatically in B4J and B4i.

If you get an error that Base_Resize is missing then update to latest version of BCTextEngine.
 
Upvote 0

FrankDev

Active Member
Licensed User
Longtime User
Hello Erel,

thank you for your support. That was the solution. Now it works.
Heading has been adjusted.

regards
Frank
 
Upvote 0
Top