svghmi/widget_list.ysl2
author Edouard Tisserant <edouard.tisserant@gmail.com>
Fri, 11 Oct 2024 10:18:57 +0200
changeset 4025 92b3701fceed
parent 3556 5d73bed497de
permissions -rw-r--r--
SVGHMI: Extend ForEach widget to expose range, position and size in a way comparable with ScrollBar widget.
// widget_list.ysl2

widget_desc("List") {
    longdesc
    ||
    List widget is a svg:group, list items are labeled elements
    in that group.

    To use a List, clone (svg:use) one of the items inside the widget that
    expects a List.

    Positions of items are relative to each other, and they must all be in the
    same place. In order to make editing easier it is therefore recommanded to
    make stacked clones of svg elements spread nearby the list.
    ||

    shortdesc > A named list of named graphical elements

    arg name="listname"
}

widget_defs("List") {
    |     items: {
    foreach "$hmi_element/*[@inkscape:label]" {
    |         "«@inkscape:label»": "«@id»",
    }
    |     },
}

widget_class("List");