svghmi/widget_image.ysl2
author Edouard Tisserant <edouard.tisserant@gmail.com>
Sun, 08 Dec 2024 15:26:26 +0100
changeset 4065 d876242447da
parent 4056 4b2de1a0fbf9
permissions -rw-r--r--
IDE: fix exception when changing or resizing comments in FBD
4056
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
     1
// widget_image.ysl2
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
     2
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
     3
widget_desc("Image") {
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
     4
    longdesc
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
     5
    ||
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
     6
    If Image widget is a svg:image element, then href content is replaced by
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
     7
    value of given variable.
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
     8
    ||
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
     9
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
    10
    shortdesc > Image display
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
    11
}
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
    12
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
    13
widget_class("Image")
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
    14
    ||
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
    15
        frequency = 5;
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
    16
        dispatch(value, oldval, index) {
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
    17
            if (index == 0) {
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
    18
                this.given_url = value;
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
    19
                this.ready = true;
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
    20
                this.request_animate();
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
    21
            }
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
    22
        }
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
    23
    ||
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
    24
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
    25
widget_defs("Image") {
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
    26
    |     given_url: "",
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
    27
    |     ready: false,
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
    28
    |     animate: function(){
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
    29
    |       this.element.setAttribute('href', this.given_url);
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
    30
    |     },
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
    31
    |
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
    32
    |     init: function() {
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
    33
    |       this.animate();
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
    34
    |     },
4b2de1a0fbf9 Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)
Dino Kosic <44305363+kraskrom@users.noreply.github.com>
parents:
diff changeset
    35
}