svghmi/widget_back.ysl2
author Edouard Tisserant
Wed, 01 Dec 2021 09:54:02 +0100
branchRuntimeLists
changeset 3394 9ea29ac18837
parent 3241 fe945f1f48b7
child 3653 d5ff60e906b0
permissions -rw-r--r--
RUNTIME: Variable trace now uses limited list and buffer instead of flags in instance tree that was requiring systematical instance tree traversal, and worst size buffer. Forcing and retain still use tree traversal.
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
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3232
diff changeset
     3
widget_desc("Back") {
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3232
diff changeset
     4
    longdesc
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3232
diff changeset
     5
    ||
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3232
diff changeset
     6
    Back widget brings focus back to previous page in history when clicked.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3232
diff changeset
     7
    ||
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3232
diff changeset
     8
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3232
diff changeset
     9
    shortdesc > Jump to previous page
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3232
diff changeset
    10
}
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3232
diff changeset
    11
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3232
diff changeset
    12
// TODO: use es6
3232
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2958
diff changeset
    13
widget_class("Back")
2958
895d3f2b1786 SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2912
diff changeset
    14
    ||
895d3f2b1786 SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2912
diff changeset
    15
        on_click(evt) {
895d3f2b1786 SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2912
diff changeset
    16
            if(jump_history.length > 1){
895d3f2b1786 SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2912
diff changeset
    17
               jump_history.pop();
895d3f2b1786 SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2912
diff changeset
    18
               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
    19
               switch_page(page_name, index);
895d3f2b1786 SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2912
diff changeset
    20
            }
895d3f2b1786 SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2912
diff changeset
    21
        }
895d3f2b1786 SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2912
diff changeset
    22
        init() {
895d3f2b1786 SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2912
diff changeset
    23
            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
    24
        }
895d3f2b1786 SVGHMI: Back button updated to class style
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2912
diff changeset
    25
    ||