Hello, I do not use the B4X technology. So I can not find an example of how to make a screen copy of the panel and all the elements on this panel. I can not use this code because I do not have B4XView objects
B4X view snapshot:
Sub Button1_Click
Dim bmp As B4XBitmap = Crop_Image(Panel1, Panel1.left, Panel1.top, Panel1.width, Panel1.height )
Dim out As OutputStream
out = File.OpenOutput(File.DirInternal, "1.png", False)
bmp.WriteToStream(out, 100, "PNG")
out.Close
End Sub
Sub Crop_Image(V As B4XView, left As Int, top As Int, width As Int, height As Int) As Bitmap
Return V.Snapshot.Crop(left, top, width, height)
End Sub
I have activated all the libraries of XUI, but I have problems
with text labels that are on the panel next to the picture. My task is to make a snapshot of the panel containing the picture, text label and spinner.
snapshot:
Dim pnl as B4XView, bmp as B4XBitmap
pnl=Mypnl
bmp=pnl.Snapshot
MyBmp=bmp
You almost certainly used the same bad name, "f," for a different variable elsewhere; that is, you might have declared f as Int.
Always use decent variable names!
To answer the question in the first post:
If you have a variable named pnl1, which is (mistakenly) declared as Panel then you should use this code to take a snapshot:
B4X:
Dim bmp As B4XBitmap = pnl.As(B4XView).Snapshot
Any other question or issue you encounter is not relevant to this question.
And you should use latest version of B4A with an updated SDK. Otherwise you will not be able to set the targetSdkVersion as required.
And there is no such thing "B4X technologies". B4XView is a thin wrapper with multiplatform and improved API. Nothing fancy.
You almost certainly used the same bad name, "f," for a different variable elsewhere; that is, you might have declared f as Int.
Always use decent variable names!
I have a name module "F" in which my user functions are written. When the library XUI is not activated there are no problems, but when XUI is activated a problem occurs. Do you advise changing the name of my module?
Sure, but the problem is that you used F as the module name and then created a variable with the same name.
modMyUtils is a good name for the module.
xFont (or FontX) is a good name for your B4XFont variable.
To answer the question in the first post:
If you have a variable named pnl1, which is (mistakenly) declared as Panel then you should use this code to take a snapshot:
B4X:
Dim bmp As B4XBitmap = pnl.As(B4XView).Snapshot
Any other question or issue you encounter is not relevant to this question.
And you should use latest version of B4A with an updated SDK. Otherwise you will not be able to set the targetSdkVersion as required.
And there is no such thing "B4X technologies". B4XView is a thin wrapper with multiplatform and improved API. Nothing fancy.
The conflict was between the name of my module "F" and the variable "F" in the font description in the XUI Views libraries. Now everything works, thank you very much to everyone. Maybe more informative variable names should be used inside the XUI Views libraries too.