<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.1" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Styling the Flex TabNavigator control</title>
	<link>http://blog.flexexamples.com/2007/09/26/styling-the-flex-tabnavigator-control/</link>
	<description>A bunch of examples for Adobe Flex and ActionScript</description>
	<pubDate>Fri, 05 Dec 2008 11:14:16 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>

	<item>
		<title>By: deenalex</title>
		<link>http://blog.flexexamples.com/2007/09/26/styling-the-flex-tabnavigator-control/#comment-16655</link>
		<author>deenalex</author>
		<pubDate>Mon, 10 Nov 2008 13:04:13 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/09/26/styling-the-flex-tabnavigator-control/#comment-16655</guid>
		<description>Hi peter,

I have task to show bottom faced tab navigation, i mean opposite view of normal tab navigation. It depends on style of tab or i have to change codes in normal Tab navigation itself….?

Thanks in Advance….
deenalex</description>
		<content:encoded><![CDATA[<p>Hi peter,</p>
<p>I have task to show bottom faced tab navigation, i mean opposite view of normal tab navigation. It depends on style of tab or i have to change codes in normal Tab navigation itself….?</p>
<p>Thanks in Advance….<br />
deenalex</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Venkat from India</title>
		<link>http://blog.flexexamples.com/2007/09/26/styling-the-flex-tabnavigator-control/#comment-16482</link>
		<author>Venkat from India</author>
		<pubDate>Thu, 30 Oct 2008 10:12:05 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/09/26/styling-the-flex-tabnavigator-control/#comment-16482</guid>
		<description>I have tabs whose header text will be really long. Is there a way to increase the headers width accordingly. I am getting the text truncated right now.</description>
		<content:encoded><![CDATA[<p>I have tabs whose header text will be really long. Is there a way to increase the headers width accordingly. I am getting the text truncated right now.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peterd</title>
		<link>http://blog.flexexamples.com/2007/09/26/styling-the-flex-tabnavigator-control/#comment-15421</link>
		<author>peterd</author>
		<pubDate>Tue, 09 Sep 2008 15:41:43 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/09/26/styling-the-flex-tabnavigator-control/#comment-15421</guid>
		<description>prashant,

This "works" but feels a bit hacky. The trick seems to be calling &lt;code&gt;&lt;em&gt;TabNavigator&lt;/em&gt;.getChildIndex()&lt;/code&gt; and getting an instance of the specific tab/button, then calling the &lt;code&gt;setStyle()&lt;/code&gt; method and setting the &lt;code&gt;fontStyle&lt;/code&gt; style to "normal" or "italic" depending on whether the tab is being enabled or disabled:
&lt;pre class="code"&gt;
&#60;?xml version="1.0" encoding="utf-8"?&#62;
&#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"&#62;

    &#60;mx:Script&#62;
        &#60;![CDATA[
            import mx.controls.Button;
            import mx.core.UIComponent;

            private function checkBox_change(evt:Event):void {
                var checkBox:CheckBox = evt.currentTarget as CheckBox;
                var tabNavChild:UIComponent = checkBox.data as UIComponent;
                tabNavChild.enabled = checkBox.selected;
                var idx:int = tabNav.getChildIndex(tabNavChild) as int;
                var tab:Button = tabNav.getTabAt(idx);
                var normalOrItalic:String = (checkBox.selected) ? "normal" : "italic"; 
                tab.setStyle("fontStyle", normalOrItalic);
            }
        ]]&#62;
    &#60;/mx:Script&#62;

    &#60;mx:ApplicationControlBar dock="true"&#62;
        &#60;mx:VBox&#62;
            &#60;mx:CheckBox id="checkBox1"
                    label="Toggle ONE"
                    selected="true"
                    data="{vBox1}"
                    change="checkBox_change(event);" /&#62;
            &#60;mx:CheckBox id="checkBox2"
                    label="Toggle TWO"
                    selected="true"
                    data="{vBox2}"
                    change="checkBox_change(event);" /&#62;
            &#60;mx:CheckBox id="checkBox3"
                    label="Toggle THREE"
                    selected="true"
                    data="{vBox3}"
                    change="checkBox_change(event);" /&#62;
        &#60;/mx:VBox&#62;
    &#60;/mx:ApplicationControlBar&#62;

    &#60;mx:TabNavigator id="tabNav" width="200" height="100"&#62;
        &#60;mx:VBox id="vBox1" label="ONE" /&#62;
        &#60;mx:VBox id="vBox2" label="TWO" /&#62;
        &#60;mx:VBox id="vBox3" label="THREE" /&#62;
    &#60;/mx:TabNavigator&#62;
    
&#60;/mx:Application&#62;
&lt;/pre&gt;

Actually, looking at the problem again, this may be the better approach/solution. The following example listens for the &lt;code&gt;enabledChanged&lt;/code&gt; event on the TabNavigator container's VBox children and then toggles the &lt;code&gt;fontStyle&lt;/code&gt; style accordingly:
&lt;pre class="code"&gt;
&#60;?xml version="1.0" encoding="utf-8"?&#62;
&#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        initialize="init();"&#62;

    &#60;mx:Script&#62;
        &#60;![CDATA[
            import mx.controls.Button;

            private function init():void {
                vBox1.addEventListener("enabledChanged",
                            vBox_enabledChange);
                vBox2.addEventListener("enabledChanged",
                            vBox_enabledChange);
                vBox3.addEventListener("enabledChanged",
                            vBox_enabledChange);
            }
            
            private function vBox_enabledChange(evt:Event):void {
                var vBox:VBox = evt.currentTarget as VBox;
                var idx:int = tabNav.getChildIndex(vBox);
                var btn:Button = tabNav.getTabAt(idx) as Button;
                var normalOrItalic:String = (vBox.enabled) ? "normal" : "italic";
                btn.setStyle("fontStyle", normalOrItalic);
            }
        ]]&#62;
    &#60;/mx:Script&#62;

    &#60;mx:ApplicationControlBar dock="true"&#62;
        &#60;mx:VBox&#62;
            &#60;mx:CheckBox id="checkBox1"
                    label="Toggle ONE"
                    selected="true" /&#62;
            &#60;mx:CheckBox id="checkBox2"
                    label="Toggle TWO"
                    selected="true" /&#62;
            &#60;mx:CheckBox id="checkBox3"
                    label="Toggle THREE"
                    selected="true"/&#62;
        &#60;/mx:VBox&#62;
    &#60;/mx:ApplicationControlBar&#62;

    &#60;mx:TabNavigator id="tabNav" width="200" height="100"&#62;
        &#60;mx:VBox id="vBox1"
                label="ONE"
                enabled="{checkBox1.selected}" /&#62;
        &#60;mx:VBox id="vBox2"
                label="TWO"
                enabled="{checkBox2.selected}" /&#62;
        &#60;mx:VBox id="vBox3"
                label="THREE"
                enabled="{checkBox3.selected}" /&#62;
    &#60;/mx:TabNavigator&#62;

&#60;/mx:Application&#62;
&lt;/pre&gt;

Hope that helps,

Peter</description>
		<content:encoded><![CDATA[<p>prashant,</p>
<p>This &#8220;works&#8221; but feels a bit hacky. The trick seems to be calling <code><em>TabNavigator</em>.getChildIndex()</code> and getting an instance of the specific tab/button, then calling the <code>setStyle()</code> method and setting the <code>fontStyle</code> style to &#8220;normal&#8221; or &#8220;italic&#8221; depending on whether the tab is being enabled or disabled:</p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.controls.Button;
            import mx.core.UIComponent;

            private function checkBox_change(evt:Event):void {
                var checkBox:CheckBox = evt.currentTarget as CheckBox;
                var tabNavChild:UIComponent = checkBox.data as UIComponent;
                tabNavChild.enabled = checkBox.selected;
                var idx:int = tabNav.getChildIndex(tabNavChild) as int;
                var tab:Button = tabNav.getTabAt(idx);
                var normalOrItalic:String = (checkBox.selected) ? "normal" : "italic";
                tab.setStyle("fontStyle", normalOrItalic);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:VBox&gt;
            &lt;mx:CheckBox id="checkBox1"
                    label="Toggle ONE"
                    selected="true"
                    data="{vBox1}"
                    change="checkBox_change(event);" /&gt;
            &lt;mx:CheckBox id="checkBox2"
                    label="Toggle TWO"
                    selected="true"
                    data="{vBox2}"
                    change="checkBox_change(event);" /&gt;
            &lt;mx:CheckBox id="checkBox3"
                    label="Toggle THREE"
                    selected="true"
                    data="{vBox3}"
                    change="checkBox_change(event);" /&gt;
        &lt;/mx:VBox&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:TabNavigator id="tabNav" width="200" height="100"&gt;
        &lt;mx:VBox id="vBox1" label="ONE" /&gt;
        &lt;mx:VBox id="vBox2" label="TWO" /&gt;
        &lt;mx:VBox id="vBox3" label="THREE" /&gt;
    &lt;/mx:TabNavigator&gt;

&lt;/mx:Application&gt;
</pre>
<p>Actually, looking at the problem again, this may be the better approach/solution. The following example listens for the <code>enabledChanged</code> event on the TabNavigator container&#8217;s VBox children and then toggles the <code>fontStyle</code> style accordingly:</p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        initialize="init();"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.controls.Button;

            private function init():void {
                vBox1.addEventListener("enabledChanged",
                            vBox_enabledChange);
                vBox2.addEventListener("enabledChanged",
                            vBox_enabledChange);
                vBox3.addEventListener("enabledChanged",
                            vBox_enabledChange);
            }

            private function vBox_enabledChange(evt:Event):void {
                var vBox:VBox = evt.currentTarget as VBox;
                var idx:int = tabNav.getChildIndex(vBox);
                var btn:Button = tabNav.getTabAt(idx) as Button;
                var normalOrItalic:String = (vBox.enabled) ? "normal" : "italic";
                btn.setStyle("fontStyle", normalOrItalic);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:VBox&gt;
            &lt;mx:CheckBox id="checkBox1"
                    label="Toggle ONE"
                    selected="true" /&gt;
            &lt;mx:CheckBox id="checkBox2"
                    label="Toggle TWO"
                    selected="true" /&gt;
            &lt;mx:CheckBox id="checkBox3"
                    label="Toggle THREE"
                    selected="true"/&gt;
        &lt;/mx:VBox&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:TabNavigator id="tabNav" width="200" height="100"&gt;
        &lt;mx:VBox id="vBox1"
                label="ONE"
                enabled="{checkBox1.selected}" /&gt;
        &lt;mx:VBox id="vBox2"
                label="TWO"
                enabled="{checkBox2.selected}" /&gt;
        &lt;mx:VBox id="vBox3"
                label="THREE"
                enabled="{checkBox3.selected}" /&gt;
    &lt;/mx:TabNavigator&gt;

&lt;/mx:Application&gt;
</pre>
<p>Hope that helps,</p>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: prashant</title>
		<link>http://blog.flexexamples.com/2007/09/26/styling-the-flex-tabnavigator-control/#comment-15416</link>
		<author>prashant</author>
		<pubDate>Tue, 09 Sep 2008 12:51:06 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/09/26/styling-the-flex-tabnavigator-control/#comment-15416</guid>
		<description>Hi,

i need to style the disabled tab color i.e. i need to make the disable tab text italic.
i could find the "selectedTabTextStyleName" property but is there any way to style disabled tab text. i am using Flex 2.

Thanks

-prashant</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>i need to style the disabled tab color i.e. i need to make the disable tab text italic.<br />
i could find the &#8220;selectedTabTextStyleName&#8221; property but is there any way to style disabled tab text. i am using Flex 2.</p>
<p>Thanks</p>
<p>-prashant</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: philippe-l</title>
		<link>http://blog.flexexamples.com/2007/09/26/styling-the-flex-tabnavigator-control/#comment-12207</link>
		<author>philippe-l</author>
		<pubDate>Tue, 22 Apr 2008 15:29:04 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/09/26/styling-the-flex-tabnavigator-control/#comment-12207</guid>
		<description>Hello, 
I have the same problem than Aidoru.
I don't know how coul'd i change a specified tab style ...

does anyone have an idea ?

thanks a lot</description>
		<content:encoded><![CDATA[<p>Hello,<br />
I have the same problem than Aidoru.<br />
I don&#8217;t know how coul&#8217;d i change a specified tab style &#8230;</p>
<p>does anyone have an idea ?</p>
<p>thanks a lot</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aidoru</title>
		<link>http://blog.flexexamples.com/2007/09/26/styling-the-flex-tabnavigator-control/#comment-6558</link>
		<author>Aidoru</author>
		<pubDate>Fri, 01 Feb 2008 11:03:44 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/09/26/styling-the-flex-tabnavigator-control/#comment-6558</guid>
		<description>I'm having the very same problem right now. I can't find a way to do that, but I can't believe it's impossible either. I've been stuck on this for hours now.</description>
		<content:encoded><![CDATA[<p>I&#8217;m having the very same problem right now. I can&#8217;t find a way to do that, but I can&#8217;t believe it&#8217;s impossible either. I&#8217;ve been stuck on this for hours now.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raul R</title>
		<link>http://blog.flexexamples.com/2007/09/26/styling-the-flex-tabnavigator-control/#comment-4334</link>
		<author>Raul R</author>
		<pubDate>Mon, 19 Nov 2007 09:52:17 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/09/26/styling-the-flex-tabnavigator-control/#comment-4334</guid>
		<description>Hello, this is a very interesting job. But How could I change the background color of a "not selected tab"? I have tried with disabled-color but I have no result.

Thankss a lot.</description>
		<content:encoded><![CDATA[<p>Hello, this is a very interesting job. But How could I change the background color of a &#8220;not selected tab&#8221;? I have tried with disabled-color but I have no result.</p>
<p>Thankss a lot.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael J Godfrey</title>
		<link>http://blog.flexexamples.com/2007/09/26/styling-the-flex-tabnavigator-control/#comment-4219</link>
		<author>Michael J Godfrey</author>
		<pubDate>Fri, 16 Nov 2007 22:34:15 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/09/26/styling-the-flex-tabnavigator-control/#comment-4219</guid>
		<description>So, I've been battling the firstTabStyleName and lastTabStyleName style properties and realized that at least Flex 2.01 does not even implement them. So if your example had any differences between each of these styles, they would not render as expected, but all look the same. It seems that Flex meant to override the firstButtonStyleName and lastButtonStyleName style properties from ButtonBar, but never got around to it. So if you use those properties, you can get the desired result.</description>
		<content:encoded><![CDATA[<p>So, I&#8217;ve been battling the firstTabStyleName and lastTabStyleName style properties and realized that at least Flex 2.01 does not even implement them. So if your example had any differences between each of these styles, they would not render as expected, but all look the same. It seems that Flex meant to override the firstButtonStyleName and lastButtonStyleName style properties from ButtonBar, but never got around to it. So if you use those properties, you can get the desired result.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nicii</title>
		<link>http://blog.flexexamples.com/2007/09/26/styling-the-flex-tabnavigator-control/#comment-3624</link>
		<author>nicii</author>
		<pubDate>Fri, 26 Oct 2007 17:57:55 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/09/26/styling-the-flex-tabnavigator-control/#comment-3624</guid>
		<description>thanks man, not a fan of the color line that follows each tab !</description>
		<content:encoded><![CDATA[<p>thanks man, not a fan of the color line that follows each tab !</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pierre</title>
		<link>http://blog.flexexamples.com/2007/09/26/styling-the-flex-tabnavigator-control/#comment-3145</link>
		<author>Pierre</author>
		<pubDate>Tue, 02 Oct 2007 11:50:02 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/09/26/styling-the-flex-tabnavigator-control/#comment-3145</guid>
		<description>Peter,

I will got to this adress and find the answer.


Thanks for your help</description>
		<content:encoded><![CDATA[<p>Peter,</p>
<p>I will got to this adress and find the answer.</p>
<p>Thanks for your help</p>
]]></content:encoded>
	</item>
</channel>
</rss>
