svghmi/widget_back.ysl2
author Edouard Tisserant <edouard.tisserant@gmail.com>
Tue, 13 Apr 2021 21:04:46 +0200
branchsvghmi
changeset 3229 c5be4fd425e7
parent 2958 895d3f2b1786
child 3232 7bdb766c2a4d
permissions -rw-r--r--
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.

Multiple widget DnD and mutiple variable still make no sense because all path are replaced with same path, but atleast min/max value are preserved...
2902
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
     1
// widget_back.ysl2
2779
75c6a31caca6 SVGHMI: Work In Progress : fixed pointer types in ctypes interface, cleaned up server startup and cleanup code, changed document type to XHTML, cleaner JS script : encapsulated in a function and in CDATA.
Edouard Tisserant
parents: 2763
diff changeset
     2
2958
895d3f2b1786 SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2912
diff changeset
     3
template "widget[@type='Back']", mode="widget_class"
895d3f2b1786 SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2912
diff changeset
     4
    ||
895d3f2b1786 SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2912
diff changeset
     5
    class BackWidget extends Widget{
895d3f2b1786 SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2912
diff changeset
     6
        on_click(evt) {
895d3f2b1786 SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2912
diff changeset
     7
            if(jump_history.length > 1){
895d3f2b1786 SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2912
diff changeset
     8
               jump_history.pop();
895d3f2b1786 SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2912
diff changeset
     9
               let [page_name, index] = jump_history.pop();
895d3f2b1786 SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2912
diff changeset
    10
               switch_page(page_name, index);
895d3f2b1786 SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2912
diff changeset
    11
            }
895d3f2b1786 SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2912
diff changeset
    12
        }
895d3f2b1786 SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2912
diff changeset
    13
        init() {
895d3f2b1786 SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2912
diff changeset
    14
            this.element.setAttribute("onclick", "hmi_widgets['"+this.element_id+"'].on_click(evt)");
895d3f2b1786 SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2912
diff changeset
    15
        }
895d3f2b1786 SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2912
diff changeset
    16
    }
895d3f2b1786 SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2912
diff changeset
    17
    ||