Maybe the best solution would be:
A tap on an unhighlighted word highlights the paragraph containing the word.
A tap on a word in a highlighted paragraph highlights that word differently from the paragraph.
A double tap on a highlighted paragraph unhighlights the entire paragraph and all words in the paragraph.
Sub Process_Globals
End Sub
Sub Globals
Dim SelectableWebView1 As SelectableWebView
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.AddMenuItem("EnableSelection", "MenuItem")
SelectableWebView1.Initialize("SelectableWebView1")
Activity.AddView(SelectableWebView1, 0, 0, 100%x, 100%y)
SelectableWebView1.LoadUrl("http://www.b4x.com/forum/basic4android-updates-questions/14437-highlight-text-webview-long-tap-3.html#post99556")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub MenuItem_Click
SelectableWebView1.EnableSelectionMode
End Sub
Sub SelectableWebView1_SelectionReady(SelectedText As String)
Msgbox(SelectedText, "Selected text:")
End Sub
I think you'd have to create another javascript function in the web page and call that function from your Activity - in the SelectionReady Sub.
Pass the SelectedText to the new javascript function and the function would find the text and highlight it.
But that function would have to find and highlight all occurences of the selected text i think...
If the user highlighted common text such as 'the' then the javascript function wouldn't know which occurence of 'the' had been highlighted, so highlighting all occurences would be the only option.
Is that any use or must you be able to highlight the exact single occurence of the selected text?
Martin.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?