<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Extending Flex Framework: Value-Aware ComboBox</title>
	<atom:link href="http://flexblog.faratasystems.com/2006/12/12/extending-flex-framework-value-aware-combobox/feed" rel="self" type="application/rss+xml" />
	<link>http://flexblog.faratasystems.com/2006/12/12/extending-flex-framework-value-aware-combobox</link>
	<description>A blog about our experience with Adobe Flex</description>
	<lastBuildDate>Fri, 03 Sep 2010 02:18:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: uasy</title>
		<link>http://flexblog.faratasystems.com/2006/12/12/extending-flex-framework-value-aware-combobox/comment-page-1#comment-69152</link>
		<dc:creator>uasy</dc:creator>
		<pubDate>Wed, 31 Mar 2010 14:03:54 +0000</pubDate>
		<guid isPermaLink="false">http://flexblog.faratasystems.com/?p=132#comment-69152</guid>
		<description>Hello Victor,

&lt;code&gt;&lt;br /&gt;
&#160;&#160;&#160;&#160;private function applyValue(val:Object):void &lt;br /&gt;
&#160;&#160;&#160;&#160;{&lt;br /&gt;
&#160;&#160;&#160;&#160;&#160;&#160;if ((val != null) &amp;&amp; (dataProvider != null)) &lt;br /&gt;
&#160;&#160;&#160;&#160;&#160;&#160;{&lt;br /&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for (var i : int = 0; i &lt; dataProvider.length; i++) &lt;br /&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{&lt;br /&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//Используем labelField в качестве данных,&lt;br /&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//Не плохо бы добавить и labelFunction&lt;br /&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if( this.labelField != null )&lt;br /&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{&lt;br /&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if( val == dataProvider[i][labelField] ) &lt;br /&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{&lt;br /&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;selectedIndex = i;&lt;br /&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return;&lt;br /&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}&lt;br /&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} else {&lt;br /&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if( val == dataProvider[i].data &#124;&#124; val == dataProvider[i].label ) &lt;br /&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{&lt;br /&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;selectedIndex = i;&lt;br /&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return;&lt;br /&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }&lt;br /&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }&#160;&#160;&#160;&#160;&lt;br /&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }&lt;br /&gt;
&#160;&#160;&#160;&#160;&#160;&#160;}else{&lt;br /&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; selectedIndex = -1;&lt;br /&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }&lt;br /&gt;
&#160;&#160;&#160;&#160; }&lt;br /&gt;
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Hello Victor,</p>
<p><code><br />
&nbsp;&nbsp;&nbsp;&nbsp;private function applyValue(val:Object):void <br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ((val != null) &amp;amp;&amp;amp; (dataProvider != null)) <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (var i : int = 0; i &amp;lt; dataProvider.length; i++) <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//Используем labelField в качестве данных,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//Не плохо бы добавить и labelFunction<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if( this.labelField != null )<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if( val == dataProvider[i][labelField] ) <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;selectedIndex = i;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if( val == dataProvider[i].data || val == dataProvider[i].label ) <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;selectedIndex = i;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}else{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; selectedIndex = -1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;&nbsp; }<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bmilesp</title>
		<link>http://flexblog.faratasystems.com/2006/12/12/extending-flex-framework-value-aware-combobox/comment-page-1#comment-33422</link>
		<dc:creator>bmilesp</dc:creator>
		<pubDate>Tue, 18 Dec 2007 07:07:38 +0000</pubDate>
		<guid isPermaLink="false">http://flexblog.faratasystems.com/?p=132#comment-33422</guid>
		<description>Hello Victor,
Great post btw,  it&#039;s leading me in a good direction. 

I&#039;m trying to get your combobox modification to do a bidirectional bind with a data model:

  public function set value(val:Object) : void {
       candidateValue = val;
       valueDirty = true;
       invalidateProperties();
/*****************************************dispatch here
      dispatchEvent(new Event(&quot;changeValue&quot;));
   }
   
/*****************************************bind here
   [Bindable(event=&quot;changeValue&quot;)]
   override public function get value():Object {
		if (editable)
		  return text;
	
		var item:Object = selectedItem;
		if (item == null &#124;&#124; typeof(item) != &quot;object&quot;){
			return item;
   		}
		return &quot;data&quot; in item ? item.data : item.label;
   }


however, i get the warning: &#039;Data binding will not be able to detiect assignments to &quot;value&quot; &#039; regardless. I know the value property is available on the stock combobox, do you know of a way to make the value property bindable again?  Thank you immensely.</description>
		<content:encoded><![CDATA[<p>Hello Victor,<br />
Great post btw,  it&#8217;s leading me in a good direction. </p>
<p>I&#8217;m trying to get your combobox modification to do a bidirectional bind with a data model:</p>
<p>  public function set value(val:Object) : void {<br />
       candidateValue = val;<br />
       valueDirty = true;<br />
       invalidateProperties();<br />
/*****************************************dispatch here<br />
      dispatchEvent(new Event(&#8220;changeValue&#8221;));<br />
   }</p>
<p>/*****************************************bind here<br />
   [Bindable(event="changeValue")]<br />
   override public function get value():Object {<br />
		if (editable)<br />
		  return text;</p>
<p>		var item:Object = selectedItem;<br />
		if (item == null || typeof(item) != &#8220;object&#8221;){<br />
			return item;<br />
   		}<br />
		return &#8220;data&#8221; in item ? item.data : item.label;<br />
   }</p>
<p>however, i get the warning: &#8216;Data binding will not be able to detiect assignments to &#8220;value&#8221; &#8216; regardless. I know the value property is available on the stock combobox, do you know of a way to make the value property bindable again?  Thank you immensely.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simpulton</title>
		<link>http://flexblog.faratasystems.com/2006/12/12/extending-flex-framework-value-aware-combobox/comment-page-1#comment-15288</link>
		<dc:creator>Simpulton</dc:creator>
		<pubDate>Thu, 10 May 2007 05:49:08 +0000</pubDate>
		<guid isPermaLink="false">http://flexblog.faratasystems.com/?p=132#comment-15288</guid>
		<description>Samian, clearly you have made a fallacy of equivocation. If having to extend a framework writing a few functions is too much of a burden that is fine,  but don&#039;t imply that if Adobe had gotten the Flex combo box right then it &#039;could be&#039; a &#039;good old fashioned HTML dropdown&#039;. I do not think that having to borrow one class and dropping it into a project is going to convince very many people that we should forfeit the whole list of benefits that a Flex combo box has to offer over a &#039;good old fashioned HTML dropdown&#039;. 

Which makes me wonder what constitutes an RIA if having to &#039;write functions&#039; is clearly a demerit towards the seal of approval. I suppose I could dust off my old etch-a-sketch and send it on over unless of course you already have the .NET etch-a-sketch in which case you clearly already know everything there is to know.</description>
		<content:encoded><![CDATA[<p>Samian, clearly you have made a fallacy of equivocation. If having to extend a framework writing a few functions is too much of a burden that is fine,  but don&#8217;t imply that if Adobe had gotten the Flex combo box right then it &#8216;could be&#8217; a &#8216;good old fashioned HTML dropdown&#8217;. I do not think that having to borrow one class and dropping it into a project is going to convince very many people that we should forfeit the whole list of benefits that a Flex combo box has to offer over a &#8216;good old fashioned HTML dropdown&#8217;. </p>
<p>Which makes me wonder what constitutes an RIA if having to &#8216;write functions&#8217; is clearly a demerit towards the seal of approval. I suppose I could dust off my old etch-a-sketch and send it on over unless of course you already have the .NET etch-a-sketch in which case you clearly already know everything there is to know.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: samiam</title>
		<link>http://flexblog.faratasystems.com/2006/12/12/extending-flex-framework-value-aware-combobox/comment-page-1#comment-13239</link>
		<dc:creator>samiam</dc:creator>
		<pubDate>Fri, 27 Apr 2007 16:16:57 +0000</pubDate>
		<guid isPermaLink="false">http://flexblog.faratasystems.com/?p=132#comment-13239</guid>
		<description>Should&#039;nt all this &quot;functionality&quot; be already built into a combo box control?   My God look at all the code i need to write to get a combo box to work just like a good old fashioned HTML dropdown.  In order to set a selected value i need to write functions and in order to pass a value different than than the selectedItem  I also need to write a function.   RIA my ass. Did I miss the boat? Shouldnt these functions already be part of the class?    .NET has all this stuff built in.    Com&#039;n Adobe/Flex team  get it right. I love to think what flex &quot;could be&quot; but it ain&#039;t there yet.   I don&#039;t want to re-write or extend classes to do basic functionality that should be built in.</description>
		<content:encoded><![CDATA[<p>Should&#8217;nt all this &#8220;functionality&#8221; be already built into a combo box control?   My God look at all the code i need to write to get a combo box to work just like a good old fashioned HTML dropdown.  In order to set a selected value i need to write functions and in order to pass a value different than than the selectedItem  I also need to write a function.   RIA my ass. Did I miss the boat? Shouldnt these functions already be part of the class?    .NET has all this stuff built in.    Com&#8217;n Adobe/Flex team  get it right. I love to think what flex &#8220;could be&#8221; but it ain&#8217;t there yet.   I don&#8217;t want to re-write or extend classes to do basic functionality that should be built in.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Victor Rasputnis</title>
		<link>http://flexblog.faratasystems.com/2006/12/12/extending-flex-framework-value-aware-combobox/comment-page-1#comment-1060</link>
		<dc:creator>Victor Rasputnis</dc:creator>
		<pubDate>Tue, 19 Dec 2006 00:57:24 +0000</pubDate>
		<guid isPermaLink="false">http://flexblog.faratasystems.com/?p=132#comment-1060</guid>
		<description>Valery, thank you for the comment. You are absolutely right, but this was an introductory post just to demo expandablity of the Flex framework.  We&#039;ve addressed  this issue in our book which dedicates an entire chapter to tricks with comboboxes. Did not know about Boolean, though :)

Thank you so much again,
Victor</description>
		<content:encoded><![CDATA[<p>Valery, thank you for the comment. You are absolutely right, but this was an introductory post just to demo expandablity of the Flex framework.  We&#8217;ve addressed  this issue in our book which dedicates an entire chapter to tricks with comboboxes. Did not know about Boolean, though <img src='http://flexblog.faratasystems.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Thank you so much again,<br />
Victor</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Valery Silaev</title>
		<link>http://flexblog.faratasystems.com/2006/12/12/extending-flex-framework-value-aware-combobox/comment-page-1#comment-1056</link>
		<dc:creator>Valery Silaev</dc:creator>
		<pubDate>Mon, 18 Dec 2006 14:41:01 +0000</pubDate>
		<guid isPermaLink="false">http://flexblog.faratasystems.com/?p=132#comment-1056</guid>
		<description>Victor,

Your ComboBox works incorrectly in table -- the initial value is not passed.
To overcome this problem you need the following method override:
/* A small override of &quot;set data&quot; in mx.controls. ComboBox           */
/* This allows to use value-aware version in DataGrid and List-s */
override public function set data(data:Object):void {
  super.data = data;
  if (listData &amp;&amp; listData is DataGridListData) {
    candidateValue = data[DataGridListData(listData).dataField];
    valueDirty = true;			
  }
  else if (listData is ListData &amp;&amp; ListData(listData).labelField in data) {
    candidateValue = data[ListData(listData).labelField];
    valueDirty = true;			
  }
}

=======
Moreover, original mx.controls.ComboBase class has small error in &quot;get value&quot; -- as a result, you may not use ComboBox if values are Boolean (namely, Boolean(false) )
Here is the fix:

override public function get value():Object {
  if (editable)
    return text;

  var item:Object = selectedItem;

  if (item == null &#124;&#124; typeof(item) != &quot;object&quot;)
    return item;

  return &quot;data&quot; in item ? item.data : item.label;
}	

Valery</description>
		<content:encoded><![CDATA[<p>Victor,</p>
<p>Your ComboBox works incorrectly in table &#8212; the initial value is not passed.<br />
To overcome this problem you need the following method override:<br />
/* A small override of &#8220;set data&#8221; in mx.controls. ComboBox           */<br />
/* This allows to use value-aware version in DataGrid and List-s */<br />
override public function set data(data:Object):void {<br />
  super.data = data;<br />
  if (listData &amp;&amp; listData is DataGridListData) {<br />
    candidateValue = data[DataGridListData(listData).dataField];<br />
    valueDirty = true;<br />
  }<br />
  else if (listData is ListData &amp;&amp; ListData(listData).labelField in data) {<br />
    candidateValue = data[ListData(listData).labelField];<br />
    valueDirty = true;<br />
  }<br />
}</p>
<p>=======<br />
Moreover, original mx.controls.ComboBase class has small error in &#8220;get value&#8221; &#8212; as a result, you may not use ComboBox if values are Boolean (namely, Boolean(false) )<br />
Here is the fix:</p>
<p>override public function get value():Object {<br />
  if (editable)<br />
    return text;</p>
<p>  var item:Object = selectedItem;</p>
<p>  if (item == null || typeof(item) != &#8220;object&#8221;)<br />
    return item;</p>
<p>  return &#8220;data&#8221; in item ? item.data : item.label;<br />
}	</p>
<p>Valery</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jack</title>
		<link>http://flexblog.faratasystems.com/2006/12/12/extending-flex-framework-value-aware-combobox/comment-page-1#comment-934</link>
		<dc:creator>Jack</dc:creator>
		<pubDate>Wed, 13 Dec 2006 21:04:19 +0000</pubDate>
		<guid isPermaLink="false">http://flexblog.faratasystems.com/?p=132#comment-934</guid>
		<description>Ben Forta posted a similar component here: http://www.forta.com/blog/index.cfm/2006/11/22/Flex-ComboBox-With-selectedValue-Support

He calls the method setValue()

I needed to bind a 2-character state code to a combobox to show the full state name, just like your example.

I&#039;m kind of surprised that Flex doesn&#039;t have this built-in, but you made it easy to work with with your component. 

Thanks!</description>
		<content:encoded><![CDATA[<p>Ben Forta posted a similar component here: <a href="http://www.forta.com/blog/index.cfm/2006/11/22/Flex-ComboBox-With-selectedValue-Support" rel="nofollow">http://www.forta.com/blog/index.cfm/2006/11/22/Flex-ComboBox-With-selectedValue-Support</a></p>
<p>He calls the method setValue()</p>
<p>I needed to bind a 2-character state code to a combobox to show the full state name, just like your example.</p>
<p>I&#8217;m kind of surprised that Flex doesn&#8217;t have this built-in, but you made it easy to work with with your component. </p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
