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

Erel

Administrator
Staff member
Licensed 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

Well-Known Member
Licensed 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
@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 :D
 

jimmyF

Active Member
Licensed 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

Well Known Member
Licensed 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

Administrator
Staff member
Licensed 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.
 

Mahares

Well Known Member
Licensed 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
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! :D
 

Erel

Administrator
Staff member
Licensed 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

  • 16.3 KB Views: 43
Last edited:

Erel

Administrator
Staff member
Licensed User
V1.02 - New BBCodeView.Padding field. Can be used to change the padding.
 

mcqueccu

Active Member
Licensed 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).
 

Erel

Administrator
Staff member
Licensed User
Should the text from the database be formatted? Is it BBCode?
If not then wrap it with the 'plain' tag.
 

mcqueccu

Active Member
Licensed 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
 

Erel

Administrator
Staff member
Licensed User
The Plain tag is intended exactly for this use case. If you encounter any problem then post it and it will be fixed.
 
Top