svghmi/widget_image.ysl2
author Dino Kosic <44305363+kraskrom@users.noreply.github.com>
Mon, 02 Dec 2024 11:33:19 +0100
changeset 4056 4b2de1a0fbf9
permissions -rw-r--r--
Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)

* Extend Jsontable widget, create Edit CSV POU, create example for both

* Add doc for HMI:Image and HMI:JsonTable

* Expand example to include HMI:Image
// widget_image.ysl2

widget_desc("Image") {
    longdesc
    ||
    If Image widget is a svg:image element, then href content is replaced by
    value of given variable.
    ||

    shortdesc > Image display
}

widget_class("Image")
    ||
        frequency = 5;
        dispatch(value, oldval, index) {
            if (index == 0) {
                this.given_url = value;
                this.ready = true;
                this.request_animate();
            }
        }
    ||

widget_defs("Image") {
    |     given_url: "",
    |     ready: false,
    |     animate: function(){
    |       this.element.setAttribute('href', this.given_url);
    |     },
    |
    |     init: function() {
    |       this.animate();
    |     },
}