Search code examples
open-sourcelsfusion

lsFusion: dynamic change property headers on a form


Good afternoon. I can't find an example of how to dynamically change property headers on a form?

I've tried to find the proper command in the documentation but not succeed yet. Is it captionMyProp? how to use it?


Solution

  • There is an option HEADER of property (or action) being added to the form structure. Quote from the documentation:

    HEADER propertyExpression

    Specifying a property that determines the header for the column of the property (action) being added. The return value of this property will be used as the header. If the return value is NULL, then the added property (action) will be automatically hidden.

    Example:

    CLASS Operation;
    type = DATA STRING (Operation);
    
    CLASS Item;
    name = DATA STRING (Item);
    
    FORM Sample
        OBJECTS o=Operation, i=Item
        PROPERTIES(o) NEW, type
        PROPERTIES(i) NEW, name HEADER type(o) + ' result'
    ;
    

    In the example above, the header of the name column will depend on the current value of the Operation object. It's also possible to make the header depend on the Item object itself.