After spending my requisite two+ hours searching here and playing monkeys and typewriters I feel like I must be missing something.
I want it to work in B4J/B4A/B4i so I am trying to use a B4XImageView and B4XCanvas but B4XCanvas requires a B4XView and I don't HAVE a B4xView to draw on, I have a B4XImageView.
One of the many things I tried was adding a B4x view in code, but you can't initialize it so I tried adding a pane initializing it and then setting the B4xview to the pane even though that would mean different code for J/A/i. But this fails when I try to actually set the B4XImageView.SetBitmap.
Here is the code:
Interestingly, this will give me the text I want, but it is evidently drawing on the base and I can't figure out how to clear it:
What I am trying to do:
Get A file / path from the DB.
IF there is no file listed in the DB I hide the View
IF there is a file I Load it.
If the File is MISSING then I want to to say File Missing on the View.
Yes, I know there are a lot of other ways to solve this but this just seemed like the logical, simple way to do it. Now extra views to add/remove etc.
Also, setting the background color doesn't actually do anything until you .setbitmap which is OK unless the first image of the day is missing.
I want it to work in B4J/B4A/B4i so I am trying to use a B4XImageView and B4XCanvas but B4XCanvas requires a B4XView and I don't HAVE a B4xView to draw on, I have a B4XImageView.
One of the many things I tried was adding a B4x view in code, but you can't initialize it so I tried adding a pane initializing it and then setting the B4xview to the pane even though that would mean different code for J/A/i. But this fails when I try to actually set the B4XImageView.SetBitmap.
B4X:
java.lang.ClassCastException: class anywheresoftware.b4j.objects.PaneWrapper$ConcretePaneWrapper$NonResizePane cannot be cast to class javafx.scene.image.ImageView (anywheresoftware.b4j.objects.PaneWrapper$ConcretePaneWrapper$NonResizePane is in unnamed module of loader 'app'; javafx.scene.image.ImageView is in module javafx.graphics of loader 'app')
B4X:
Dim Cnv As B4XCanvas, P As Pane, BXV As B4XView
P.Initialize("")
BXV = P
IMV.Clear
Cnv.Initialize(BXV)
Cnv.DrawText($"File${CRLF}Missing!"$, IMV.mBase.Width / 2, IMV.mBase.Height / 2, xui.CreateDefaultBoldFont(20), xui.Color_Red, "CENTER")
IMV.mBackgroundColor = xui.Color_Blue
IMV.Clear
IMV.setbitmap(BXV.GetBitmap)
B4X:
Dim Cnv As B4XCanvas
Cnv.Initialize(IMV.mBase)
Cnv.DrawText($"File${CRLF}Missing!"$, IMV.mBase.Width / 2, IMV.mBase.Height / 2, xui.CreateDefaultBoldFont(20), xui.Color_Red, "CENTER")
IMV.mBackgroundColor = xui.Color_Blue
IMV.Clear
Get A file / path from the DB.
IF there is no file listed in the DB I hide the View
IF there is a file I Load it.
If the File is MISSING then I want to to say File Missing on the View.
Yes, I know there are a lot of other ways to solve this but this just seemed like the logical, simple way to do it. Now extra views to add/remove etc.
Also, setting the background color doesn't actually do anything until you .setbitmap which is OK unless the first image of the day is missing.