You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2019/08/14 06:02:18 UTC

[royale-asjs] 03/08: handle measuredWidth without measuring non-UIComponent renderers

This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit 08d7e91a114b5d97ae9462e2d4b13c5a25d178ac
Author: Alex Harui <ah...@apache.org>
AuthorDate: Tue Aug 13 16:28:56 2019 -0700

    handle measuredWidth without measuring non-UIComponent renderers
---
 .../src/main/royale/mx/controls/ToggleButtonBar.as | 26 +++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/ToggleButtonBar.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/ToggleButtonBar.as
index a64e0a9..ac4d190 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/ToggleButtonBar.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/ToggleButtonBar.as
@@ -90,7 +90,7 @@ import org.apache.royale.core.ILayoutHost;
  *  @playerversion AIR 1.1
  *  @productversion Flex 3
  */
-[Style(name="buttonWidth", type="Number", format="Length", inherit="no")]
+//[Style(name="buttonWidth", type="Number", format="Length", inherit="no")]
 
 
 	
@@ -447,6 +447,30 @@ public class ToggleButtonBar extends UIComponent implements ILayoutParent, ILayo
         dispatchEvent(new Event("initComplete"));
     }
 
+    private var _buttonWidth:int;
+    
+    public function get buttonWidth():int
+    {
+        return _buttonWidth;
+    }
+    public function set buttonWidth(value:int):void
+    {
+        _buttonWidth = value;
+    }
+    
+    override public function get measuredWidth():Number
+    {
+        if (dataProvider)
+            return buttonWidth * dataProvider.length;
+        return 0;
+    }
+    
+    override public function get measuredHeight():Number
+    {
+        if (dataProvider)
+            return height; // do a better measurement someday
+        return 0;
+    }
 }
 
 }