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 2018/10/29 00:57:05 UTC

[royale-asjs] branch develop updated: Jewel DropDownList complete

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 b1d28dc  Jewel DropDownList complete
b1d28dc is described below

commit b1d28dc25e60c7ddb51693b60637aa687a6ea89b
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Mon Oct 29 01:56:58 2018 +0100

    Jewel DropDownList complete
---
 .../src/main/royale/DropDownListPlayGround.mxml             | 13 ++++++++-----
 .../src/main/royale/org/apache/royale/jewel/DropDownList.as |  6 +-----
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/examples/royale/JewelExample/src/main/royale/DropDownListPlayGround.mxml b/examples/royale/JewelExample/src/main/royale/DropDownListPlayGround.mxml
index 895188c..874fc58 100644
--- a/examples/royale/JewelExample/src/main/royale/DropDownListPlayGround.mxml
+++ b/examples/royale/JewelExample/src/main/royale/DropDownListPlayGround.mxml
@@ -32,7 +32,8 @@ limitations under the License.
             }
             
 			private function avengersDropDownListHandler_noPrompt(event:Event):void {
-                avengersDropDownListResult_noPrompt.html = "<strong>DropDownList selectedItem:</strong> " + event.target.selectedItem.label;
+				if(event.target.selectedItem != null)
+                	avengersDropDownListResult_noPrompt.html = "<strong>DropDownList selectedItem:</strong> " + event.target.selectedItem.label;
             }
 
             private function watchmenDropDownListHandler(event:Event):void {
@@ -48,11 +49,13 @@ limitations under the License.
             }
             
 			private function avengersDropDownListHandler_withSelectedIndex(event:Event):void {
-                avengersDropDownListResult_withSelectedIndex.html = "<strong>DropDownList selectedItem:</strong> " + event.target.selectedItem.label;
+				if(event.target.selectedItem != null)
+                	avengersDropDownListResult_withSelectedIndex.html = "<strong>DropDownList selectedItem:</strong> " + event.target.selectedItem.label;
             }
             
 			private function avengersDropDownListHandler_withSelectedItem(event:Event):void {
-                avengersDropDownListResult_withSelectedItem.html = "<strong>DropDownList selectedItem:</strong> " + event.target.selectedItem.label;
+				if(event.target.selectedItem != null)
+                	avengersDropDownListResult_withSelectedItem.html = "<strong>DropDownList selectedItem:</strong> " + event.target.selectedItem.label;
             }
 		]]>
 	</fx:Script>
@@ -204,7 +207,7 @@ limitations under the License.
 					tabletNumerator="1" tabletDenominator="1"
 					phoneNumerator="1" phoneDenominator="1">
 			<j:Card>
-				<html:H3 text="Jewel DropDownList (String Collection) with SelectedIndex"/>
+				<html:H3 text="Jewel DropDownList (String Collection) with SelectedIndex: {watchmenDropDownList_withSelectedIndex.selectedIndex}"/>
 				
 				<j:Grid gap="true" itemsVerticalAlign="itemsCentered">
 					<j:GridCell desktopNumerator="1" desktopDenominator="3"
@@ -238,7 +241,7 @@ limitations under the License.
 					tabletNumerator="1" tabletDenominator="1"
 					phoneNumerator="1" phoneDenominator="1">
 			<j:Card>
-				<html:H3 text="Jewel DropDownList (Object Collection) with SelectedIndex"/>
+				<html:H3 text="Jewel DropDownList (Object Collection) with SelectedIndex: {avengersDropDownList_withSelectedIndex.selectedIndex}"/>
 				
 				<j:Grid gap="true" itemsVerticalAlign="itemsCentered">
 					<j:GridCell desktopNumerator="1" desktopDenominator="3"
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/DropDownList.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/DropDownList.as
index adbb870..904424b 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/DropDownList.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/DropDownList.as
@@ -253,10 +253,6 @@ package org.apache.royale.jewel
         public function set selectedItem(value:Object):void
         {
             ISelectionModel(model).selectedItem = value;
-            // COMPILE::JS
-            // {
-            //     (element as HTMLSelectElement).selectedIndex = ISelectionModel(model).selectedIndex;
-            // }
         }
 
         /**
@@ -302,7 +298,7 @@ package org.apache.royale.jewel
         protected function changeHandler(event:Event):void
         {
             var index:int = (element as HTMLSelectElement).selectedIndex;
-            model.selectedIndex = (index == 0) ? -1 : (element as HTMLSelectElement).selectedIndex;
+            model.selectedIndex = (index == 0) ? -1 : index;
         }
     }
 }