Share My Creation MakeBxL - create a layout file from text or from an SQLite table (B4X) (Tool) (Source included)

I wanted a quick way to generate a layout file (add the views and their names and events) to then fine-tune it with the Designer - MakeBxL does that, either from
- a list of names (for the views) that you add in its TextArea, or
- from an SQLite database table
Some additional options are available - see the screenshots below.

All basic views for B4A, B4I, and B4J are included in the project. To extract custom views from layout files, use the 'Extract custom view' RadioButton and then click the 'Select file' button to select the layout file, after which you can pick one from a list of views in that file. See post 11 for a how-to if you want/need to do that manually.

Hints:
- To make your own specific version of a view (with different properties like e.g. colours, text, ...) make a layout that contains it and then extract it as a custom view.
- After extracting custom views, you may want to give the extracted files more significant names. E.g., when extracting a Button, the produced files may have names like 'bjl.button1.hdr.json' and 'bjl.button1.json'. If you rename them, only replace the 'button1' part and make it identical for both files, e.g. 'bjl.BigRedButton.hdr.json' and 'bjl.BigRedButton.json'.

Screenshots and project attached, enjoy!

CHANGES:
- 2024-02-07 (v1.03):
* Added custom view extraction from layout files
* Corrected bug in 'CustomViews' directory processing when file names weren't all lowercase

- 2024-02-06 (v1.02):
* Added tests to avoid exceptions if definition files are missing
* Added custom views processing (in other words, 'Bring Your own Views'); see post 11 for a how-to
* Updated project attached

- 2024-02-05 (v1.01):
* B4I (.bil) processing added (thank you for the json file, @mcqueccu)
* A check was added for duplicate view names
* Updated project attached

- 2024-02-09 (v1.04):
* Enhanced custom view extraction as per @Mashiane's suggestions/request in post 13
* Custom view extraction now has an '<All>' option to extract all views from the selected layout file (so either select one view, or get all of them)
* Custom view extraction now makes sure each view has a distinct name (across the complete collection of standard views and custom views)
* The 'Restart' button now refreshes the lists of available views, no need to exit and restart the entire program
* Added column 'JSON' to the TableView, which shows the view's JSON as a TreeView (based on JsonTree: https://www.b4x.com/android/forum/t...ith-json-parsing-updated-as-23-4-2022.140068/)
* Used ComboBoxes instead of ChoiceBoxes for improved performance
* Bug fixes

- 2024-02-10 (v1.05):
* Bug fixes (thank you for pointing out the ChoiceBox/ComboBox issue, @Mariano Ismael Castro )

Start:

Start.png


SQLite-based:

SQLite1.png
SQLite2.png


SQLite3.png
SQLite4.png


SQLite9.png


Text-based:

Text1.png
Text2.png


Text3.png
Text4.png


Extraction:

Extract1.png
Extract2.png
 

Attachments

  • SQLite2.png
    SQLite2.png
    31.8 KB · Views: 385
  • Text1.png
    Text1.png
    13.2 KB · Views: 351
  • Text2.png
    Text2.png
    32.6 KB · Views: 352
  • Start.png
    Start.png
    15.6 KB · Views: 233
  • MakeBxL.zip
    79.3 KB · Views: 179
Last edited:

Mashiane

Expert
Licensed User
Longtime User
Tip: On the generated json files, if you want to manipulate the content and do updates using Map variable to it before generating the final json, you need to remove

B4X:
"$MAKEBXL_CHILD_NUM$":

On the first line. The json parser does not understand this as valid json.

See example.
 

Attachments

  • Files.zip
    1.3 KB · Views: 132

walt61

Active Member
Licensed User
Longtime User
Sneak preview: coming up tomorrow in v1.04 (got to run now and still need to test/polish some things):
- enhanced custom view extraction as per @Mashiane's suggestions/request in post 13
- custom view extraction now has an '<All>' option to extract all views from the selected layout file (so either select one view, or get all of them)
- custom view extraction now makes sure each view has a distinct name (across the complete collection of standard views and custom views)
- the 'Restart' button now refreshes the lists of available views, no need to exit and restart the entire program
- added column 'JSON' to the TableView, which shows the view's JSON as a TreeView (based on JsonTree: https://www.b4x.com/android/forum/t...ith-json-parsing-updated-as-23-4-2022.140068/)
- used ComboBoxes instead of ChoiceBoxes for improved performance
- bug fixes
 
Top