Android Question BBCodeView - long press or tap on the word

js486dog

Active Member
Licensed User
I have used the BBCodeView as the alternative for the EditText.
Please can I use long press or tap on the word in plain text?
I need to use long tap on the word in plain text on BBCodeView and after the word is writen on the label or EditText.

If yes please how can I do it?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Out of the box you can use the LinkClicked events with URL tags.

You can use this code to find the clicked work:
1. Add this after you set the text:
B4X:
Dim TouchPanel As B4XView = xui.CreatePanel("TouchPanel")
Dim fv As B4XView = BBCodeView1.ForegroundImageView
BBCodeView1.sv.ScrollViewInnerPanel.AddView(TouchPanel, fv.Left, fv.Top, fv.Width, fv.Height)

2. Handle the event:
B4X:
Sub TouchPanel_Touch (Action As Int, X As Float, Y As Float)
   If Action = BBCodeView1.sv.TOUCH_ACTION_UP Then
       Dim single As BCSingleStyleSection = TextEngine.FindSingleStyleSection(BBCodeView1.Paragraph, X, Y)
       If single <> Null Then
           Activity.Title = single.ParentUN.Text
           Log(single.ParentUN.Text)
       End If
   End If
End Sub
 
Upvote 0
Top