B4J Question get string height and width

Bel

Member
Licensed User
Hi
B4j is powerful thanks Erel i use it.
but i cannot get string height look like b4a (stringutill)
is there library to get string height?
Too i cannot justify label or textview,how do it?
 

stevel05

Expert
Licensed User
Longtime User
That's a tough one. The first question would be do you have to show it in your app? Could you call an external PDF reader maybe. Otherwise you will have to work out the sizings for each page, match a page of text to font / pane sizes, parse the text into suitable sized pages and display them in order. In effect write a basic book reader.
 
Upvote 0

Bel

Member
Licensed User
That's a tough one. The first question would be do you have to show it in your app? Could you call an external PDF reader maybe. Otherwise you will have to work out the sizings for each page, match a page of text to font / pane sizes, parse the text into suitable sized pages and display them in order. In effect write a basic book reader.
How parse text to suitable size page?use substring?
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
You'll need to give some more details.

What format is the document in?
How will the user access the document?

If it's a text document, the simplest way would be to display the text in a webview and let the web view take care of the scrolling etc., but it depends on the format of the document.
 
Upvote 0

Bel

Member
Licensed User
You'll need to give some more details.

What format is the document in?
How will the user access the document?

If it's a text document, the simplest way would be to display the text in a webview and let the web view take care of the scrolling etc., but it depends on the format of the document.
I save text in sqlite and read it to show.maybe 100 page text save in database.
simple text saved in database
i read text from database and show it in label but i grouping it in 100 pane
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
As a start I would try displaying the text in a webview and see what it looks like. You should soon be able to tell if it will be usable. Then you can worry about the formatting.
 
Upvote 0

Bel

Member
Licensed User
As a start I would try displaying the text in a webview and see what it looks like. You should soon be able to tell if it will be usable. Then you can worry about the formatting.
i know there is webview but i need to show it in label
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Then you need to work out how much text will fit into the label, and break the text into pages.

I suggest that you parse the text into a list based on the amount of text that will fit into one label, then provide page forward and next buttons to allow moving through the text.

Search the forum for ways to measure text, there are a few possible methods, some work better than others for a particular job, test some and see if you like the results.
 
Upvote 0

Bel

Member
Licensed User
Then you need to work out how much text will fit into the label, and break the text into pages.

I suggest that you parse the text into a list based on the amount of text that will fit into one label, then provide page forward and next buttons to allow moving through the text.

Search the forum for ways to measure text, there are a few possible methods, some work better than others for a particular job, test some and see if you like the results.
Thank you.my idea was parse the text into list based on the amount looklike your idea.
I have a base pane with 600x1100 size and how do i split text?(with measure-height or how)
 
Upvote 0
Top