Tyavkin
New Member
Hello everyone, I would like to share an idea and get feedback from the community.
B4X layout files (.bal / .bjl / .bil) ↔︎ a simple, human-readable text DSL
The goal is to make working with layouts more convenient outside of the visual designer.
A similar transition has happened in the past in other environments.
For example, Delphi layout files (.dfm) were originally binary and later also supported
a text-based representation, which made version control, diffing and manual editing much easier.
A text-based representation for B4X layouts could make it easier to:
while remaining close enough to the original model to allow round-trip conversion.
I’ve started experimenting with this idea using B4J (still at a very early stage).
I’m currently exploring different approaches, including analyzing layout files
and working with layouts loaded via LoadLayout.
At this point I’m mainly interested in feedback on the idea itself
and whether something like this would be useful to the B4X ecosystem.
Any thoughts are welcome.
Idea
The idea is to create a bidirectional converter between:B4X layout files (.bal / .bjl / .bil) ↔︎ a simple, human-readable text DSL
The goal is to make working with layouts more convenient outside of the visual designer.
A similar transition has happened in the past in other environments.
For example, Delphi layout files (.dfm) were originally binary and later also supported
a text-based representation, which made version control, diffing and manual editing much easier.
A text-based representation for B4X layouts could make it easier to:
- edit layouts in a structured and predictable way
- review changes and track history in version control systems
- share and exchange layouts between developers
- generate or refactor layouts programmatically
while remaining close enough to the original model to allow round-trip conversion.
Example DSL:
Panel root {
width = 100%
height = 100%
Label lblTitle {
text = "Settings"
textSize = 20
textColor = #222222
top = 10
left = 10
}
TextField txtUser {
promptText = "User name"
width = 200
top = 50
left = 10
}
CheckBox chkNotifications {
text = "Enable notifications"
checked = true
top = 90
left = 10
}
Button btnOk {
text = "OK"
width = 80
top = 130
left = 10
}
}
Scope
- Support all B4X layout types:
- .bal (B4A)
- .bjl (B4J)
- .bil (B4i)
- A single DSL format for all platforms (with little diffs)
- Conversion in both directions: Layout ↔︎ DSL
I’ve started experimenting with this idea using B4J (still at a very early stage).
I’m currently exploring different approaches, including analyzing layout files
and working with layouts loaded via LoadLayout.
At this point I’m mainly interested in feedback on the idea itself
and whether something like this would be useful to the B4X ecosystem.
Any thoughts are welcome.