svghmi/widget_back.ysl2
author Edouard Tisserant
Wed, 13 Jan 2021 10:28:09 +0100
branchsvghmi
changeset 3109 6c39d718e8cb
parent 2958 895d3f2b1786
child 3232 7bdb766c2a4d
permissions -rw-r--r--
Removed harmful assert in ProcessLogger.

ProcessLogger was having an assert in constructor when missing logger, leading to systematic exception when testing options accepted by compiler. This exception was silenced in ProjectController, and then MatIEC was always called without options.
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
    ||