<?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: Setting a prompt on a ComboBox control in Flex</title>
	<atom:link href="http://blog.flexexamples.com/2008/06/01/setting-a-prompt-on-a-combobox-control-in-flex/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com/2008/06/01/setting-a-prompt-on-a-combobox-control-in-flex/</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Sun, 12 Feb 2012 14:19:03 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Andres</title>
		<link>http://blog.flexexamples.com/2008/06/01/setting-a-prompt-on-a-combobox-control-in-flex/comment-page-1/#comment-10231</link>
		<dc:creator>Andres</dc:creator>
		<pubDate>Fri, 09 Dec 2011 21:45:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/06/01/setting-a-prompt-on-a-combobox-control-in-flex/#comment-10231</guid>
		<description>Its possible prompt always visible in combobox?</description>
		<content:encoded><![CDATA[<p>Its possible prompt always visible in combobox?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anita Devi</title>
		<link>http://blog.flexexamples.com/2008/06/01/setting-a-prompt-on-a-combobox-control-in-flex/comment-page-1/#comment-9058</link>
		<dc:creator>Anita Devi</dc:creator>
		<pubDate>Wed, 16 Mar 2011 10:22:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/06/01/setting-a-prompt-on-a-combobox-control-in-flex/#comment-9058</guid>
		<description>Thanks for the useful information here Peter. Could you tell me how you would format the prompt text to be in italics and after a user has made a selection, set the selected text to be in normal[not italics] style? Setting the textInputStyleName to a style that sets the font to italics affects BOTH the prompt style and any user selection.</description>
		<content:encoded><![CDATA[<p>Thanks for the useful information here Peter. Could you tell me how you would format the prompt text to be in italics and after a user has made a selection, set the selected text to be in normal[not italics] style? Setting the textInputStyleName to a style that sets the font to italics affects BOTH the prompt style and any user selection.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nesh</title>
		<link>http://blog.flexexamples.com/2008/06/01/setting-a-prompt-on-a-combobox-control-in-flex/comment-page-1/#comment-7194</link>
		<dc:creator>Nesh</dc:creator>
		<pubDate>Mon, 08 Mar 2010 14:59:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/06/01/setting-a-prompt-on-a-combobox-control-in-flex/#comment-7194</guid>
		<description>How would you set up a StringValidator (MXML not actionscript) with required set to true for the combobox that is editable AND has a prompt set? 
My problem is that if I set a validator with required =true, since the combobox is editable and has a prompt the validator always validates TRUE since the prompt is there, however that is wrong as the prompt is not an actual value (just like in the example above &#039;Please select a State&#039; is not the value you want... )... I tried using NumberValidator but that again will not work as the editable combobox always has SelectedIndex = -1 if you are typing the value in there... any thoughts?</description>
		<content:encoded><![CDATA[<p>How would you set up a StringValidator (MXML not actionscript) with required set to true for the combobox that is editable AND has a prompt set?<br />
My problem is that if I set a validator with required =true, since the combobox is editable and has a prompt the validator always validates TRUE since the prompt is there, however that is wrong as the prompt is not an actual value (just like in the example above &#8216;Please select a State&#8217; is not the value you want&#8230; )&#8230; I tried using NumberValidator but that again will not work as the editable combobox always has SelectedIndex = -1 if you are typing the value in there&#8230; any thoughts?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anon</title>
		<link>http://blog.flexexamples.com/2008/06/01/setting-a-prompt-on-a-combobox-control-in-flex/comment-page-1/#comment-6845</link>
		<dc:creator>Anon</dc:creator>
		<pubDate>Mon, 25 Jan 2010 18:38:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/06/01/setting-a-prompt-on-a-combobox-control-in-flex/#comment-6845</guid>
		<description>Wow - thanks for this great trick!  It&#039;s something I never knew.</description>
		<content:encoded><![CDATA[<p>Wow &#8211; thanks for this great trick!  It&#8217;s something I never knew.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter deHaan</title>
		<link>http://blog.flexexamples.com/2008/06/01/setting-a-prompt-on-a-combobox-control-in-flex/comment-page-1/#comment-5779</link>
		<dc:creator>Peter deHaan</dc:creator>
		<pubDate>Tue, 15 Sep 2009 20:56:59 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/06/01/setting-a-prompt-on-a-combobox-control-in-flex/#comment-5779</guid>
		<description>@Liviu,

That may be a bug in the Flash CS3+ ComboBox control. 
Can you please submit a bug report via http://www.adobe.com/go/wish/ and include your test code.

Thanks,
Peter</description>
		<content:encoded><![CDATA[<p>@Liviu,</p>
<p>That may be a bug in the Flash CS3+ ComboBox control.<br />
Can you please submit a bug report via <a href="http://www.adobe.com/go/wish/" rel="nofollow">http://www.adobe.com/go/wish/</a> and include your test code.</p>
<p>Thanks,<br />
Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Liviu</title>
		<link>http://blog.flexexamples.com/2008/06/01/setting-a-prompt-on-a-combobox-control-in-flex/comment-page-1/#comment-5778</link>
		<dc:creator>Liviu</dc:creator>
		<pubDate>Tue, 15 Sep 2009 17:57:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/06/01/setting-a-prompt-on-a-combobox-control-in-flex/#comment-5778</guid>
		<description>Hi

I&#039;m not sure about Flex, I am not familiar with MXML, but in AS3 written in Flash CS3, an editable ComboBox that has been edited by the user does not respond to selectedIndex = -1 anymore; 

I just opened a new Document, and threw on stage a ComboBox named cb, and a button named b, and wrote this code:

&lt;pre lang=&quot;Actionscript&quot;&gt;
import fl.data.*;
cb.editable = true;
cb.dataProvider = new DataProvider([&quot;one&quot;, &quot;two&quot;, &quot;3&quot;]);
cb.prompt = &quot;Choose a number&quot;;
b.addEventListener(MouseEvent.CLICK, onClickButton);
function onClickButton(e){
	cb.selectedIndex = -1;
}
&lt;/pre&gt;

Whenever you write something into the ComboBox, the button has no effect.</description>
		<content:encoded><![CDATA[<p>Hi</p>
<p>I&#8217;m not sure about Flex, I am not familiar with MXML, but in AS3 written in Flash CS3, an editable ComboBox that has been edited by the user does not respond to selectedIndex = -1 anymore; </p>
<p>I just opened a new Document, and threw on stage a ComboBox named cb, and a button named b, and wrote this code:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> fl.<span style="color: #0066CC;">data</span>.<span style="color: #66cc66;">*</span>;
cb.<span style="color: #006600;">editable</span> = <span style="color: #000000; font-weight: bold;">true</span>;
cb.<span style="color: #006600;">dataProvider</span> = <span style="color: #000000; font-weight: bold;">new</span> DataProvider<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;one&quot;</span>, <span style="color: #ff0000;">&quot;two&quot;</span>, <span style="color: #ff0000;">&quot;3&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
cb.<span style="color: #006600;">prompt</span> = <span style="color: #ff0000;">&quot;Choose a number&quot;</span>;
b.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, onClickButton<span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">function</span> onClickButton<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
	cb.<span style="color: #006600;">selectedIndex</span> = -<span style="color: #cc66cc;">1</span>;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Whenever you write something into the ComboBox, the button has no effect.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter deHaan</title>
		<link>http://blog.flexexamples.com/2008/06/01/setting-a-prompt-on-a-combobox-control-in-flex/comment-page-1/#comment-5733</link>
		<dc:creator>Peter deHaan</dc:creator>
		<pubDate>Sat, 12 Sep 2009 14:51:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/06/01/setting-a-prompt-on-a-combobox-control-in-flex/#comment-5733</guid>
		<description>@Liviu,

This seems to work for me (Flex 3.4.0.9147):
&lt;pre lang=&quot;mxml&quot;&gt;
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot;&gt;

    &lt;mx:VBox&gt;
        &lt;mx:ComboBox id=&quot;cb&quot; prompt=&quot;ok&quot; dataProvider=&quot;[One,Two,Three]&quot; editable=&quot;true&quot; width=&quot;100%&quot; /&gt;
        &lt;mx:Label text=&quot;text = {cb.text}&quot; /&gt;
        &lt;mx:Label text=&quot;selectedIndex = {cb.selectedIndex}&quot; /&gt;
        &lt;mx:Label enterFrame=&quot;event.currentTarget.text = &#039;prompt = &#039; + cb.prompt;&quot; /&gt;
        &lt;mx:Button label=&quot;Set selectedIndex=-1&quot; click=&quot;cb.selectedIndex = -1;&quot; /&gt;
        &lt;mx:HRule width=&quot;100%&quot; /&gt;
        &lt;mx:Label fontWeight=&quot;bold&quot; initialize=&quot;event.currentTarget.text = mx_internal::VERSION;&quot; /&gt;
    &lt;/mx:VBox&gt;

&lt;/mx:Application&gt;
&lt;/pre&gt;

Peter</description>
		<content:encoded><![CDATA[<p>@Liviu,</p>
<p>This seems to work for me (Flex 3.4.0.9147):</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:VBox</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ComboBox</span> id=<span style="color: #ff0000;">&quot;cb&quot;</span> prompt=<span style="color: #ff0000;">&quot;ok&quot;</span> dataProvider=<span style="color: #ff0000;">&quot;[One,Two,Three]&quot;</span> editable=<span style="color: #ff0000;">&quot;true&quot;</span> width=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Label</span> text=<span style="color: #ff0000;">&quot;text = {cb.text}&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Label</span> text=<span style="color: #ff0000;">&quot;selectedIndex = {cb.selectedIndex}&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Label</span> enterFrame=<span style="color: #ff0000;">&quot;event.currentTarget.text = 'prompt = ' + cb.prompt;&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Button</span> label=<span style="color: #ff0000;">&quot;Set selectedIndex=-1&quot;</span> click=<span style="color: #ff0000;">&quot;cb.selectedIndex = -1;&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:HRule</span> width=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Label</span> fontWeight=<span style="color: #ff0000;">&quot;bold&quot;</span> initialize=<span style="color: #ff0000;">&quot;event.currentTarget.text = mx_internal::VERSION;&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:VBox</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Liviu</title>
		<link>http://blog.flexexamples.com/2008/06/01/setting-a-prompt-on-a-combobox-control-in-flex/comment-page-1/#comment-5727</link>
		<dc:creator>Liviu</dc:creator>
		<pubDate>Fri, 11 Sep 2009 23:38:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/06/01/setting-a-prompt-on-a-combobox-control-in-flex/#comment-5727</guid>
		<description>Hi Peter

I&#039;m running into a problem on resetting editable ComboBoxes back to prompt. When the user writes their own text, the ComboBox does not respond to selectedIndex=-1 anymore.</description>
		<content:encoded><![CDATA[<p>Hi Peter</p>
<p>I&#8217;m running into a problem on resetting editable ComboBoxes back to prompt. When the user writes their own text, the ComboBox does not respond to selectedIndex=-1 anymore.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter deHaan</title>
		<link>http://blog.flexexamples.com/2008/06/01/setting-a-prompt-on-a-combobox-control-in-flex/comment-page-1/#comment-3337</link>
		<dc:creator>Peter deHaan</dc:creator>
		<pubDate>Thu, 04 Jun 2009 01:51:27 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/06/01/setting-a-prompt-on-a-combobox-control-in-flex/#comment-3337</guid>
		<description>Srinivas Kusunam,

I believe if you hold down the Ctrl key (on Windows, not sure about Mac) while selecting an already selected item it will de-select that item and set the selectedIndex property back to -1.

Peter</description>
		<content:encoded><![CDATA[<p>Srinivas Kusunam,</p>
<p>I believe if you hold down the Ctrl key (on Windows, not sure about Mac) while selecting an already selected item it will de-select that item and set the selectedIndex property back to -1.</p>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Srinivas Kusunam</title>
		<link>http://blog.flexexamples.com/2008/06/01/setting-a-prompt-on-a-combobox-control-in-flex/comment-page-1/#comment-3336</link>
		<dc:creator>Srinivas Kusunam</dc:creator>
		<pubDate>Wed, 03 Jun 2009 21:47:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/06/01/setting-a-prompt-on-a-combobox-control-in-flex/#comment-3336</guid>
		<description>Thanks for the tip. Problem with the &quot;Prompt&quot; is once you select a value from the drop down then you are done you can&#039;t set it back to &quot;-1&quot; (only through code). I have 20 comboboxes which are optional and in EDIT mode user might want to select &quot;-1&quot; for some of the combo boxes for which there is a value. So far i did not find any easy solution for this. Any suggestions?</description>
		<content:encoded><![CDATA[<p>Thanks for the tip. Problem with the &#8220;Prompt&#8221; is once you select a value from the drop down then you are done you can&#8217;t set it back to &#8220;-1&#8243; (only through code). I have 20 comboboxes which are optional and in EDIT mode user might want to select &#8220;-1&#8243; for some of the combo boxes for which there is a value. So far i did not find any easy solution for this. Any suggestions?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

