SVGHMI: HMI:DropDown now temporarily takes content from widget's arguments, until HMI:List is implemented. svghmi
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Tue, 14 Apr 2020 17:31:45 +0200
branchsvghmi
changeset 2931 f51c0e2e0bcb
parent 2930 41edcb8e0a01
child 2932 abb995a30088
SVGHMI: HMI:DropDown now temporarily takes content from widget's arguments, until HMI:List is implemented.
svghmi/gen_index_xhtml.xslt
svghmi/widget_dropdown.ysl2
tests/svghmi/svghmi_0@svghmi/svghmi.svg
--- a/svghmi/gen_index_xhtml.xslt	Tue Apr 14 17:17:35 2020 +0200
+++ b/svghmi/gen_index_xhtml.xslt	Tue Apr 14 17:31:45 2020 +0200
@@ -847,11 +847,19 @@
 </xsl:text>
     <xsl:text>        this.margins = [lmargin, tmargin].map(x =&gt; Math.max(x,0));
 </xsl:text>
-    <xsl:text>        this.content = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten",
-</xsl:text>
-    <xsl:text>                        "eleven", "twelve", "thirteen", "fourteen", "fifteen"];
-</xsl:text>
-    <xsl:text>        //this.content = ["one", "two", "three", "four", "5", "6"];
+    <xsl:text>        //this.content = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten",
+</xsl:text>
+    <xsl:text>        //                "eleven", "twelve", "thirteen", "fourteen", "fifteen"];
+</xsl:text>
+    <xsl:text>        this.content = [
+</xsl:text>
+    <xsl:for-each select="arg">
+      <xsl:text>"</xsl:text>
+      <xsl:value-of select="@value"/>
+      <xsl:text>",
+</xsl:text>
+    </xsl:for-each>
+    <xsl:text>        ];
 </xsl:text>
     <xsl:text>        this.menu_offset = 0;
 </xsl:text>
--- a/svghmi/widget_dropdown.ysl2	Tue Apr 14 17:17:35 2020 +0200
+++ b/svghmi/widget_dropdown.ysl2	Tue Apr 14 17:31:45 2020 +0200
@@ -14,9 +14,11 @@
         lmargin = this.text_bbox.x - this.box_bbox.x;
         tmargin = this.text_bbox.y - this.box_bbox.y;
         this.margins = [lmargin, tmargin].map(x => Math.max(x,0));
-        this.content = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten",
-                        "eleven", "twelve", "thirteen", "fourteen", "fifteen"];
-        //this.content = ["one", "two", "three", "four", "5", "6"];
+        //this.content = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten",
+        //                "eleven", "twelve", "thirteen", "fourteen", "fifteen"];
+        this.content = [
+        ``foreach "arg" | "«@value»",
+        ];
         this.menu_offset = 0;
         this.lift = 0;
         this.opened = false;
--- a/tests/svghmi/svghmi_0@svghmi/svghmi.svg	Tue Apr 14 17:17:35 2020 +0200
+++ b/tests/svghmi/svghmi_0@svghmi/svghmi.svg	Tue Apr 14 17:31:45 2020 +0200
@@ -2492,7 +2492,7 @@
   </g>
   <g
      id="g14237"
-     inkscape:label="HMI:DropDown:Primes@/SELECTION"
+     inkscape:label="HMI:DropDown:sretgs:vfs:hgdrty:tfws:htyd:dx:treg:az:ki:qw:zvfzsdf@/SELECTION"
      transform="translate(0,-640)">
     <rect
        style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#53676c;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"