You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2019/03/03 10:27:58 UTC
[royale-asjs] branch develop updated: fix iconbutton and
togglebutton icons removed when changed text at runtime
This is an automated email from the ASF dual-hosted git repository.
carlosrovira pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new d46d60f fix iconbutton and togglebutton icons removed when changed text at runtime
d46d60f is described below
commit d46d60f213fae6b26d3f28fb8cdef38aecd6d5f4
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Sun Mar 3 11:27:50 2019 +0100
fix iconbutton and togglebutton icons removed when changed text at runtime
---
.../royale/org/apache/royale/jewel/IconButton.as | 59 +++++++++++++++++++++-
1 file changed, 58 insertions(+), 1 deletion(-)
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/IconButton.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/IconButton.as
index b494d61..49c3146 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/IconButton.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/IconButton.as
@@ -18,6 +18,12 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.royale.jewel
{
+ COMPILE::JS
+ {
+ import org.apache.royale.core.WrappedHTMLElement;
+ import org.apache.royale.html.util.addElementToWrapper;
+ }
+
import org.apache.royale.core.IIconSupport;
import org.apache.royale.core.IIcon;
@@ -34,8 +40,41 @@ package org.apache.royale.jewel
public function IconButton()
{
super();
+ }
+
+ COMPILE::JS
+ protected var textNode:Text;
+
+ COMPILE::JS
+ private var _text:String = "";
+
+ [Bindable("textChange")]
+ /**
+ * @copy org.apache.royale.html.Label#text
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ COMPILE::JS
+ override public function get text():String
+ {
+ return _text;
+ }
- //typeNames = "jewel button";
+ /**
+ * @private
+ */
+ COMPILE::JS
+ override public function set text(value:String):void
+ {
+ if (textNode)
+ {
+ _text = value;
+ textNode.nodeValue = value;
+ this.dispatchEvent('textChange');
+ }
}
private var _icon:IIcon;
@@ -76,5 +115,23 @@ package org.apache.royale.jewel
// todo set up icon on swf
}
}
+
+ /**
+ * @royaleignorecoercion org.apache.royale.core.WrappedHTMLElement
+ * @royaleignorecoercion org.apache.royale.html.util.addElementToWrapper
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ addElementToWrapper(this, 'button');
+ element.setAttribute('type', 'button');
+
+ textNode = document.createTextNode(_text) as Text;
+ element.appendChild(textNode);
+
+ positioner = element;
+
+ return element;
+ }
}
}
\ No newline at end of file