B4A Library [B4X] BCTextEngine / BBCodeView - Text engine + BBCode parser + Rich Text View

Status
Not open for further replies.

Erel

B4X founder
Staff member
Licensed User
Longtime User
If you just want to show some (rich) content to the user then you should indeed create a web page, not a native app.

BCTextEngine allows you to build your layout based on the text. The result is made of a ScrollView, an ImageView and the additional views that you added. I assume that your app should also include some logic. Otherwise go with a web page...
 

Sandman

Expert
Licensed User
Longtime User
I assume that your app should also include some logic.
Oh, absolutely! I was just considering the possibility to have a certain place in the app (that sometimes get updates that needs to be pushed out on the app stores) to instead use this solution.
 

ThRuST

Well-Known Member
Licensed User
Longtime User
@Sandman Apple secures their financial wealth from memberships so they don't care about a few people updating their apps through webpages
Unless any development tool "interferes" with their business strategy. Otherwise, business as usual and your chicks for free
 

peacemaker

Expert
Licensed User
Longtime User
your app should also include some logic
I think the text engine can parse one more tag [Logic], that is ... code block to run, where added views can be referenced and used.
 

jimmyF

Active Member
Licensed User
Longtime User
1.
why is it that the customlistview does not scroll beyond items 1 and 2
See post #18

2.
B4X:
ImageView1.Bitmap = BBCodeView1.mBase.Snapshot

3. I think this is pretty exciting. I can imagine transferring data between apps as just one of many possibilities.

-j
 

Mahares

Expert
Licensed User
Longtime User
See post #18
1. I have read post#1 and #18 of Erel and yours of #16 prior to posting. I want to know what Erel has in mind to overcome this limitation.

2. Your answer for question 2 is not what I was looking for. I would like to know if there is a program that can allow viewing the text like for example a pdf viewer the way is it formatted in the UI, not an image file.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I have read post#1 and #18 of Erel and yours of #16 prior to posting. I want to know what Erel has in mind to overcome this limitation.
The limitation has nothing to do with BBCodeView. Nesting scrollable elements is problematic in Android. Either make sure that the text is short enough not to be scrollable or don't add a scrollable element. You can for example use B4XDialog with B4XListTemplate instead.

Is there a viewer on the Android device or PC that can display the text as shown in the UI?
Yes. BBCodeView. You can use it on both Android and PC.
 

xulihang

Active Member
Licensed User
Longtime User
Should BCTextEngine be used in priority over CSBulder for B4A and TextFlow for B4J?
 

Mahares

Expert
Licensed User
Longtime User
Yes. BBCodeView. You can use it on both Android and PC
I know you can use it with B4A and B4J, but that was not my question.
I would like to know if I save the text generated by BBCodeView to a file, if there is a viewer (for Android and on PC) I can use to open the text file and see the formatted text with its images and text.
 

jimmyF

Active Member
Licensed User
Longtime User
I would like to know if I save the text generated by BBCodeView to a file, if there is a viewer (for Android and on PC) I can use to open the text file and see the formatted text with its images and text.
Sounds like a great idea for my next project! Thanks!
 

Erel

B4X founder
Staff member
Licensed User
Longtime User


Another B4J example.

The views are created with the designer and are loaded to a panel that is not part of the layout. Note that in B4i and B4J you need to make sure that the Handle Resize Event is unchecked in this layout.

Edit: Example updated with the changes required for BCTextEngine v1.50.
 

Attachments

  • 1.zip
    16.3 KB · Views: 473
Last edited:

mcqueccu

Well-Known Member
Licensed User
Longtime User
Skip unsupported tags
Hello, please I want to find out if there is a way to skip contents that are formatted with square brackets example [hello] without crashing the app? I was displaying some longs strings from a database and i get crash error.

B4X:
Error (position - 197) Invalid tag: hello
bbcodeview_createruns (java line: 173)
java.lang.RuntimeException: Object should first be initialized (List).
 

mcqueccu

Well-Known Member
Licensed User
Longtime User
The text is not supposed to be formatted, it's not needed I just realised that some of them had that square bracket around them for emphasis and it's random.

I will try and wrap it with the 'plain' and if it doesn't work then I will just find and replace all before setting it to the bbcodeview
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…