Scrolling selected text to the top of a page view

jmeuse2

Member
Licensed User
Longtime User
If I select a word or sentence from a txt document how would I programmatically scroll the line containing the word or sentence to the top of a text viewer? Any helpful code example would be appreciated.
 
Last edited:

jmeuse2

Member
Licensed User
Longtime User
The text is displayed as read only. The idea is similar to Adobe Reader 'Bookmarks' that function as a hyperlinked table of contents.

I want to 'hyperlink' to a selected word or phrase in a text document, auto-scroll the line containing the word or phrase to the top of the viewer and have the ability to format or 'Highlight' the text contained on that line. Thank you for your assistance.
 
Upvote 0

kanaida

Active Member
Licensed User
Longtime User
The text is displayed as read only. The idea is similar to Adobe Reader 'Bookmarks' that function as a hyperlinked table of contents.

I want to 'hyperlink' to a selected word or phrase in a text document, auto-scroll the line containing the word or phrase to the top of the viewer and have the ability to format or 'Highlight' the text contained on that line. Thank you for your assistance.

I think you just answered your own question :) I think a webview + some simple html would accomplish that. It's just a page anchor. That is if it's ok using html.
B4X:
HTML Links - The id Attribute

The id attribute can be used to create a bookmark inside an HTML document.

Tip: Bookmarks are not displayed in any special way. They are invisible to the reader.

Example

An anchor with an id inside an HTML document:

<a id="tips">Useful Tips Section</a>
Create a link to the "Useful Tips Section" inside the same document:

<a href="#tips">Visit the Useful Tips Section</a>
Or, create a link to the "Useful Tips Section" from another page:

<a href="http://www.w3schools.com/html_links.htm#tips">
Visit the Useful Tips Section</a>
 
Upvote 0

jmeuse2

Member
Licensed User
Longtime User
Scrolling selected string to top of viewer

Webview certainly has the right tools kanaida and I like its ability to magnify the text but would it load a text file into the viewer in one big clump of words? The text files being viewed are around 3Mb, if there's big business in reformatting the html document back into paragraphs I may need to look for another solution.

How do I load a text file into Webview to experiment with it and where do I find information about what all these <tag thingies> do?

I'm open to learning every alternative. Thank you.
 
Upvote 0

jmeuse2

Member
Licensed User
Longtime User
Webview provides a good solution

This is working very well kanaida, I've pasted a pdf into a web page developer and loaded the saved html file into WebView with good results. Thanks for the tip! :wav:
 
Upvote 0
Top