Bug? [B4X]BBCodeView Url Auto-Underline Oddities

William Lancee

Active Member
Licensed User
I found a way around these, but here they are.

B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("1")
    TextEngine.Initialize(Root)
    TextEngine.TagParser.UrlColor = 0x228b22    'breaks auto underline, except for line4 which has same color as Url color
'                        the underline is still there (it can be seen in letters such as gjqp) but is the background color (or transparent).
    BBCodeView1.TextEngine = TextEngine
    
    'Without line6 the auto underline works only for line1 and line5
    'With line6 the auto underline works as expected for all lines
    BBCodeView1.Text = _
$"
line1: this is [url]some phrase[/url] and more
line2: this is [url][b]some link2[/b][/url] and more
line3: this is [url]link3[/url] and more
line4: this is [url][color=#228b22]link4[/color][/url] and more
line5: this is [url]some phrase[/url] and more
line6: [Span MinWidth=0%x] [/Span]
"$
End Sub
 

Erel

Administrator
Staff member
Licensed User
Took me a while to find it.
You are setting the url color to be transparent. It is a bit confusing as the alpha channel is set to FF internally in some cases but not all of them.

It should be:
B4X:
TextEngine.TagParser.UrlColor = 0xFF228b22

I will fix it though it is better to explicitly set the alpha level with values outside of the bbcode.
 

William Lancee

Active Member
Licensed User
Thank you, that works. In #1 I also showed another oddity - cryptic I know.

B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("1")
    BBCodeView1.TextEngine = TextEngine
    
    'Without line6 the auto underline works only for line1 and line5
    'With line6 the auto underline works as expected for all lines
    BBCodeView1.Text = _
$"
line1: this is [url]some phrase[/url] and more
line2: this is [url][b]some link2[/b][/url] and more
line3: this is [url]link3[/url] and more
line4: this is [url][color=#228b22]link4[/color][/url] and more
line5: this is [url]some phrase[/url] and more
line6: [Span MinWidth=0%x] [/Span]
"$
End Sub
 

Erel

Administrator
Staff member
Licensed User

Erel

Administrator
Staff member
Licensed User
1. It was a simple fix after I understood what causes it.
2. You are not measuring the time correctly.

1629955234592.png

I've left my office 2 minutes after writing the first post and arrived on the next day, a few minutes before writing the second post.
We can settle on 15 minutes :)
 
Top