B4J Question How to copy or print the FULL BBCodeView?

johnmie

Active Member
Licensed User
Longtime User
My app is a CLV expandable list where each panel contains a BBCodeView.
When I copy a BBCodeView with

fx.Clipboard.SetImage:
    Dim bmp As B4XBitmap = BBCodeViewM.mBase.Snapshot
    fx.Clipboard.SetImage(bmp)

BBCodeView-test.png


I get only the visible part togehter with the vertical scrollbar. How can I get the image and only the image of the whole BBCodeView.
Is there perhaps a way to capture the entire sv to bmp?
Thanks for your help,
john m.
 

johnmie

Active Member
Licensed User
Longtime User
SOLVED
just found the solution:
solution:
Dim bmp As B4XBitmap = clv1.sv.Snapshot.Crop(0,40,580,851)
where
40 is the height of the clickable title bar
580 the view width minus the vertical scrollbar
881 the true panel display height.

It was that simple.
cheers, john m.
 
Upvote 0

johnmie

Active Member
Licensed User
Longtime User
Tip: make sure that the lazy loading option is disabled in the designer.
Thank you, Erel
but how do I do that?
could not find where in the designer for the CustomListView or in BBListItem to intervene.
Or should I load a regular (not pre-optimized) listview instead?
 
Upvote 0

johnmie

Active Member
Licensed User
Longtime User
It is in BBCodeView properties. It is not relevant if you are using BBListItem.
But line "Paragraph = mTextEngine.PrepareForLazyDrawing(Runs, Style, StubScrollView)" in BBListItem.bas under "Redraw"?
 
Upvote 0

johnmie

Active Member
Licensed User
Longtime User
Dear Erel, thank you for taking the time for this.

Make a test.
My program loads the attached *.bblst (text) file where lines beginning with "$¶" or "$>¶" are the separators that become the clickable headers, the rest in between is regular BBcode for the panels. All [url images for button links and bitmaps for table lines are already in a tempPath.

When I scroll down or enlarge the height of the window (over two monitors) everything is there, but not everybody has two screens.
Should I perhaps create a new panel in the background with the exact size?
 

Attachments

  • help_en.zip
    8.1 KB · Views: 136
Upvote 0

johnmie

Active Member
Licensed User
Longtime User
In that sense everything is fine, the attached pix shows the same panel as in post 1, but in enlarged window.

BBCodeView-test(2).png

But I still don't know how to copy or print this without having to dramatically enlarge the window.
 
Upvote 0

johnmie

Active Member
Licensed User
Longtime User
Thank you Erel very much,
it alsmost works now except the background is always black and only the text in color is visible and no pictures.
I did exactly as you said
fx.Clipboard.SetImage:
    BBCodeView1.TextEngine = TextEngine
    BBCodeView1.Text = Qtext(expandable.lastIndex)
    Dim bmx As B4XBitmap = BBCodeView1.ForegroundImageView.GetBitmap
    fx.Clipboard.SetImage(bmx)

Where Private BBCodeView1 in class globals, in Designer in parent = Form main, background white, lazy loading is disabled.
What have I missed or goofed-up?
Should the BBCodeView1 be inside a separate pane which would be resized accordingly? And can this be larger than the form?
 
Upvote 0

johnmie

Active Member
Licensed User
Longtime User
Heureka IT WORKS. phantastic!
Thank you very much Erel, you deserve an excellent free lunch!
cheers, john m.
 
Upvote 0
Top