Introducing a major update for wNim: 
[autolayout](https://khchen.github.io/wNim/autolayout.html).

Thanks to nim's powerful metaprogramming features. Now wResizable (superclass 
of wWindow) object can use autolayout module to parse [Visual Format 
Language](https://github.com/IjzerenHein/autolayout.js) and convert it to 
layout DSL at compile time.

Code example: 
    
    
    panel.autolayout """
      V:|-{col1:[child1(child2)]-[child2]}-|
      V:|-{col2:[child3(child4,child5)]-[child4]-[child5]}-|
      H:|-[col1(col2)]-[col2]-|
    """
    
    
    Run

Output: 
    
    
    panel.layout:
      child1:
        top = panel.top + 10
        height = child2.height
        left = panel.left + 10
        width = child3.width
        width = child5.width
        width = child4.width
      
      child2:
        top = child1.bottom + 10
        bottom = panel.bottom - 10
        left = panel.left + 10
        width = child3.width
        width = child5.width
        width = child4.width
      
      child3:
        top = panel.top + 10
        height = child4.height
        height = child5.height
        left = child2.right + 10
        left = child1.right + 10
        right = panel.right - 10
      
      child4:
        top = child3.bottom + 10
        left = child2.right + 10
        left = child1.right + 10
        right = panel.right - 10
      
      child5:
        top = child4.bottom + 10
        bottom = panel.bottom - 10
        left = child2.right + 10
        left = child1.right + 10
        right = panel.right - 10
    
    
    Run

To see more examples and try VFL, run examples/autolayout/autolayoutEditor.nim

Reply via email to