equal
deleted
inserted
replaced
6 decl on_mouse(position); |
6 decl on_mouse(position); |
7 decl on_dispatch(value); |
7 decl on_dispatch(value); |
8 decl jump(state); |
8 decl jump(state); |
9 decl show(eltname); |
9 decl show(eltname); |
10 decl hmi_value(value); |
10 decl hmi_value(value); |
|
11 |
|
12 gen_index_xhtml { |
11 |
13 |
12 // State machine to drive HMI_BOOL on a potentially laggy connection |
14 // State machine to drive HMI_BOOL on a potentially laggy connection |
13 const "_button_fsm" fsm { |
15 const "_button_fsm" fsm { |
14 state "init" { |
16 state "init" { |
15 on_dispatch "false" jump "released"; |
17 on_dispatch "false" jump "released"; |
102 } |
104 } |
103 template "hmi-value", mode="actions" { |
105 template "hmi-value", mode="actions" { |
104 | this.apply_hmi_value(0, «@value»); |
106 | this.apply_hmi_value(0, «@value»); |
105 } |
107 } |
106 |
108 |
107 template "widget[@type='Button']", mode="widget_class"{ |
109 } |
|
110 |
|
111 widget_class("Button"){ |
108 const "fsm","exsl:node-set($_button_fsm)"; |
112 const "fsm","exsl:node-set($_button_fsm)"; |
109 | class ButtonWidget extends Widget{ |
|
110 | frequency = 5; |
113 | frequency = 5; |
111 |
114 |
112 | display = "inactive"; |
115 | display = "inactive"; |
113 | state = "init"; |
116 | state = "init"; |
114 |
117 |
143 |
146 |
144 | init() { |
147 | init() { |
145 | this.bound_onmouseup = this.onmouseup.bind(this); |
148 | this.bound_onmouseup = this.onmouseup.bind(this); |
146 | this.element.addEventListener("pointerdown", this.onmousedown.bind(this)); |
149 | this.element.addEventListener("pointerdown", this.onmousedown.bind(this)); |
147 | } |
150 | } |
148 | } |
|
149 } |
151 } |
150 |
152 |
151 |
153 widget_defs("Button") { |
152 template "widget[@type='Button']", mode="widget_defs" { |
|
153 param "hmi_element"; |
154 param "hmi_element"; |
154 optional_labels("active inactive"); |
155 optional_labels("active inactive"); |
155 } |
156 } |