B4J Question [B4XPages] Canvas Question

KiloBravo

Active Member
Licensed User
Trying to create a simple B4Xpages UI program in B4J.
Steps...
Create a new project using the b4xpages template.
Open the internal designer and add a pane (panel) as a B4Xview.
Then I add a Canvas as a B4Xview and rename it to a B4XCanvas.

Log messages says not to initialize the Canvas because it was created with the Internal Designer.
If I do the program crashes on this line ... Root.LoadLayout("MainPage")

If I do not create the Canvas with the Designer I can add it in the code and initialize it and the program runs fine.

Is it not possible to add a Canvas as a B4Xcanvas with the Internal Designer in B4J using B4Xpages ?

Thanks!
 

mangojack

Expert
Licensed User
Longtime User
From what I gather a Canvas can be added with the Designer if your declaring it as a Canvas (or B4XView. ?)
It would appear a B4XCanvas cannot be added with the Designer.

This tutorial might explain things better or shed more light on the subject ..


[B4X] [XUI] Drawing with B4XCanvas

.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
In B4J a 'standard' Canvas is a node (view in B4A) like other user interface nodes and can be added in the Designer.
In B4A and B4i a Canvas is a Drawing object but not a view. and cannot be added in the Designer.
B4XCavas works the dame way, also in B4J, you need to declare it in the code and assign it a target view, a Panel or Pane as a B4XView.
You may also have a look at the B4X XUI booklet at chapter B4XCanvas.
 
Upvote 0

KiloBravo

Active Member
Licensed User
Thanks, I have looked at both of those links many times since picking up B4X again a couple months ago.

This answered my question ...
B4XCavas works the same way, also in B4J, you need to declare it in the code and assign it a target view, a Panel or Pane as a B4XView.

I have read the Graphics book a few times and I do not think it explicitly states that YOU HAVE TOO declare the B4XCanvas in code.
In your examples they are declared in code but my confusion was it was not stated anywhere.

I do think the Videos, Books, and Code Examples are very good. I have viewed them, read them, and played around with the code examples. The only issue I ran into was my confusion on the canvas question.

Thanks for clearing that up.

P.S. I made my own bouncing smiley program, except I used a round png of my head bouncing around. My daughter thought it was very funny. :)
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
P.S. I made my own bouncing smiley program, except I used a round png of my head bouncing around. My daughter thought it was very funny. :)

??
 
Upvote 0
Top