Using source code templates in (B4X) programming.

PaulMeuris

Active Member
Licensed User
In this tutorial you can learn about using templates in (B4X) programming.
By using templates you can reuse the code you have already written or you can translate an app into another natural language.
Simply put some placeholders in the template file, fill in the values for the placeholders and generate a .bas file.
You can find the tutorial text in the attached pmtemplates.pdf file.
The pmtemplates.zip file contains the B4J project. Unzip it to use.
The pmtemplates_examples.zip contains some examples to use with the tool. Unzip it to use.
The tool contains a layout file conversion and viewing module. 2 layers from a layout can be reviewed.
In the code you can remove the comments from the recursive code to add the remaining layers but many layers on top of each other is difficult to review.
Maybe a 3D modelling programmer can provide us with a better solution.
As always,
Happy coding!
 

Attachments

  • pmtemplates.pdf
    236.3 KB · Views: 240
  • pmtemplates.zip
    53.7 KB · Views: 235
  • pmtemplates_examples.zip
    44.6 KB · Views: 226

PaulMeuris

Active Member
Licensed User
The 3D modelling went quite well...

layout_layers2.PNG
layout_layers1.PNG

layout_layers3.PNG

I started with this website: JavaFX 3D Graphics
And in the B4XPage i used a JavaObject to run the Java code...
Happy coding!
 

kimstudio

Active Member
Licensed User
Longtime User
Any nice B4X addon tools are interesting! I tried the demo and figured out the idea inside. Any plan to make it a more mature tool and put it in share your creations board?
 

PaulMeuris

Active Member
Licensed User
Now the 3D modelling project is finished. The attached zip-file contains the source code (mostly java code in the layer class).
Each view from a layout is represented by a block and in its own layer. Complex layouts will have many layers and many blocks.
You can move the blocks by dragging the mouse along the x, y or z axis.
The position of the blocks is calculated from the upper left corner. The blocks move around the position x=50 and y=50.
Some examples:
example01.PNG

example02.PNG

example03.PNG

example04.PNG

example05.PNG

example06.PNG

Happy coding and a happy new year!
 

Attachments

  • Layout3D.zip
    34.9 KB · Views: 169
Top