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 2020/03/06 18:01:24 UTC

[royale-asjs] branch develop updated: handle binding to RB group to an RBG

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


The following commit(s) were added to refs/heads/develop by this push:
     new 9b7b437  handle binding to RB group to an RBG
9b7b437 is described below

commit 9b7b4371d1b33a4ec3e6d01d918128cf3bc4577e
Author: Alex Harui <ah...@apache.org>
AuthorDate: Fri Mar 6 10:00:59 2020 -0800

    handle binding to RB group to an RBG
---
 .../main/royale/spark/components/RadioButton.as    | 23 ++++++++++++++--------
 .../royale/spark/components/RadioButtonGroup.as    | 10 ++++++++++
 2 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/RadioButton.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/RadioButton.as
index 1934e65..95258fc 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/RadioButton.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/RadioButton.as
@@ -42,7 +42,7 @@ COMPILE::JS
     import org.apache.royale.html.supportClasses.RadioButtonIcon;
     import org.apache.royale.html.util.addElementToWrapper;
 }
-
+
 //import mx.managers.IFocusManagerGroup;
 
 use namespace mx_internal;
@@ -484,15 +484,22 @@ public class RadioButton extends ToggleButtonBase
             return;
 
         // If the button was in another group, remove it.
-        //removeFromGroup();    
+        removeFromGroup();    
 
         _group = value;  
 
         // If the group is set then the groupName is the generated name of
         // the rbg.  If it's set to null, then set the groupName back to the
         // default group so this button will move back to that group.
-       // _groupName = value ? group.name : "radioGroup";    
+        _groupName = value ? group.id : "radioGroup";    
         
+        COMPILE::JS
+        {
+            (rbicon.element as HTMLInputElement).name = _groupName;        
+        }
+
+		if (value)
+			addToGroup();
         // Make sure this gets added to it's RadioButtonGroup
         //groupChanged = true;
         
@@ -734,10 +741,10 @@ public class RadioButton extends ToggleButtonBase
     /**
      *  @private
      */
-    /* private function removeFromGroup():void
+    private function removeFromGroup():void
     {        
         // If the radio button was in a group, remove it.
-        this.dispatchEvent(new Event(Event.REMOVED));
+        //this.dispatchEvent(new Event(Event.REMOVED));
           
         // It's possible that the radio button was in the auto group.  If so,
         // delete the group if there are no other radio buttons still in it.
@@ -746,15 +753,15 @@ public class RadioButton extends ToggleButtonBase
         // specified by groupName.
         try
         {
-            if (document.automaticRadioButtonGroups[autoGroupIndex].numRadioButtons == 0)
+            if (mxmlDocument.automaticRadioButtonGroups[autoGroupIndex].numRadioButtons == 0)
             {
-                delete document.automaticRadioButtonGroups[autoGroupIndex];
+                delete mxmlDocument.automaticRadioButtonGroups[autoGroupIndex];
             }
         }
         catch(e:Error)
         {
         }
-    } */
+    }
 
     /**
      *  @private
diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/RadioButtonGroup.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/RadioButtonGroup.as
index eaa411a..59b6a8b 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/RadioButtonGroup.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/RadioButtonGroup.as
@@ -562,6 +562,16 @@ public class RadioButtonGroup extends EventDispatcher
         dispatchEvent(new Event("numRadioButtonsChanged"));
     }
 
+	private var _id:String;
+	public function get id():String
+	{
+		return _id;
+	}
+	public function set id(value:String):void
+	{
+		_id = value;
+	}
+
     /**
      *  @private
      *  Remove a radio button from the group.  This can be called by