<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Flex Examples &#187; ToggleButtonBar</title>
	<atom:link href="http://blog.flexexamples.com/category/spark/togglebuttonbar/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Wed, 26 Jan 2011 18:09:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Toggling buttons in a ToggleButtonBar control in Flex</title>
		<link>http://blog.flexexamples.com/2009/01/21/toggling-buttons-in-a-togglebuttonbar-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2009/01/21/toggling-buttons-in-a-togglebuttonbar-control-in-flex/#comments</comments>
		<pubDate>Thu, 22 Jan 2009 07:58:49 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[ToggleButtonBar]]></category>
		<category><![CDATA[toggleOnClick]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2009/01/21/toggling-buttons-in-a-togglebuttonbar-control-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can toggle buttons in a Flex ToggleButtonBar control by setting the Boolean toggleOnClick property.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2009/01/21/toggling-buttons-in-a-togglebuttonbar-control-in-flex/ --&#62; &#60;mx:Application name="ToggleButtonBar_toggleOnClick_test" xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="top" backgroundColor="white"&#62; &#60;mx:ApplicationControlBar dock="true"&#62; &#60;mx:Form styleName="plain"&#62; &#60;mx:FormItem label="toggleOnClick:"&#62; &#60;mx:CheckBox id="checkBox" /&#62; &#60;/mx:FormItem&#62; &#60;mx:FormItem label="selectedIndex:"&#62; &#60;mx:Label [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can toggle buttons in a Flex ToggleButtonBar control by setting the Boolean <code>toggleOnClick</code> property.</p>
<p>Full code after the jump.</p>
<p><span id="more-855"></span></p>
<p class="download"><a href="">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2009/01/21/toggling-buttons-in-a-togglebuttonbar-control-in-flex/ --&gt;
&lt;mx:Application name="ToggleButtonBar_toggleOnClick_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="top"
        backgroundColor="white"&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="toggleOnClick:"&gt;
                &lt;mx:CheckBox id="checkBox" /&gt;
            &lt;/mx:FormItem&gt;
            &lt;mx:FormItem label="selectedIndex:"&gt;
                &lt;mx:Label text="{toggleButtonBar.selectedIndex}" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:ToggleButtonBar id="toggleButtonBar"
            toggleOnClick="{checkBox.selected}"
            dataProvider="{viewStack}" /&gt;

    &lt;mx:ViewStack id="viewStack"
            width="100%"
            height="100%"&gt;
        &lt;mx:VBox label="Red" backgroundColor="red" /&gt;
        &lt;mx:VBox label="Orange" backgroundColor="haloOrange" /&gt;
        &lt;mx:VBox label="Yellow" backgroundColor="yellow" /&gt;
        &lt;mx:VBox label="Green" backgroundColor="haloGreen" /&gt;
        &lt;mx:VBox label="Blue" backgroundColor="haloBlue" /&gt;
    &lt;/mx:ViewStack&gt;

    &lt;mx:Label text="{Capabilities.version}" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/ToggleButtonBar_toggleOnClick_test2/bin/srcview/">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/ToggleButtonBar_toggleOnClick_test2/bin/main.html" width="100%" height="300"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Toggling buttons in a ToggleButtonBar control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2009/01/21/toggling-buttons-in-a-togglebuttonbar-control-in-flex/',contentID: 'post-855',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'toggleOnClick',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2009/01/21/toggling-buttons-in-a-togglebuttonbar-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Setting text styles for a selected button in a ToggleButtonBar control in Flex</title>
		<link>http://blog.flexexamples.com/2008/11/08/setting-text-styles-for-a-selected-button-in-a-togglebuttonbar-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/11/08/setting-text-styles-for-a-selected-button-in-a-togglebuttonbar-control-in-flex/#comments</comments>
		<pubDate>Sun, 09 Nov 2008 05:12:10 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[ToggleButtonBar]]></category>
		<category><![CDATA[selectedButtonTextStyleName]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/11/08/setting-text-styles-for-a-selected-button-in-a-togglebuttonbar-control-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can set the text color for the selected button in a Flex ToggleButtonBar control by setting the selectedButtonTextStyleName style.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/11/08/setting-text-styles-for-a-selected-button-in-a-togglebuttonbar-control-in-flex/ --&#62; &#60;mx:Application name="ToggleButtonBar_selectedButtonTextStyleName_test" xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Style&#62; .mySelectedButtonTextStyleName { color: haloBlue; } &#60;/mx:Style&#62; &#60;mx:Array [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set the text color for the selected button in a Flex ToggleButtonBar control by setting the <code>selectedButtonTextStyleName</code> style.</p>
<p>Full code after the jump.</p>
<p><span id="more-861"></span></p>
<p class="download"><a href="">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/11/08/setting-text-styles-for-a-selected-button-in-a-togglebuttonbar-control-in-flex/ --&gt;
&lt;mx:Application name="ToggleButtonBar_selectedButtonTextStyleName_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        .mySelectedButtonTextStyleName {
            color: haloBlue;
        }
    &lt;/mx:Style&gt;

    &lt;mx:Array id="arr"&gt;
        &lt;mx:Object label="One Fish" /&gt;
        &lt;mx:Object label="Two Fish" /&gt;
        &lt;mx:Object label="Red Fish" /&gt;
        &lt;mx:Object label="Blue Fish" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:ToggleButtonBar id="toggleButtonBar"
            selectedButtonTextStyleName="mySelectedButtonTextStyleName"
            dataProvider="{arr}" /&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting text styles for a selected button in a ToggleButtonBar control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/11/08/setting-text-styles-for-a-selected-button-in-a-togglebuttonbar-control-in-flex/',contentID: 'post-861',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'selectedButtonTextStyleName',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/11/08/setting-text-styles-for-a-selected-button-in-a-togglebuttonbar-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Setting a label&#8217;s font weight on a Flex LinkBar and ToggleButtonBar control</title>
		<link>http://blog.flexexamples.com/2008/01/14/setting-a-labels-font-weight-on-a-flex-linkbar-and-togglebuttonbar-control/</link>
		<comments>http://blog.flexexamples.com/2008/01/14/setting-a-labels-font-weight-on-a-flex-linkbar-and-togglebuttonbar-control/#comments</comments>
		<pubDate>Mon, 14 Jan 2008 15:28:48 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[LinkBar]]></category>
		<category><![CDATA[ToggleButtonBar]]></category>
		<category><![CDATA[buttonStyleName]]></category>
		<category><![CDATA[fontWeight]]></category>
		<category><![CDATA[linkButtonStyleName]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/01/14/setting-a-labels-font-weight-on-a-flex-linkbar-and-togglebuttonbar-control/</guid>
		<description><![CDATA[<p>The following example shows how you can set the font weight of a label on LinkBar control and ToggleButton control in Flex by setting the linkButtonStyleName style and buttonStyleName style respectively.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/LinkBar_linkButtonStyleName_fontWeight_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/01/14/setting-a-labels-font-weight-on-a-flex-linkbar-and-togglebuttonbar-control/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Style&#62; .myCustomLinkButtonStyleName { [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set the font weight of a label on LinkBar control and ToggleButton control in Flex by setting the <code>linkButtonStyleName</code> style and <code>buttonStyleName</code> style respectively.</p>
<p>Full code after the jump.</p>
<p><span id="more-449"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/LinkBar_linkButtonStyleName_fontWeight_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/01/14/setting-a-labels-font-weight-on-a-flex-linkbar-and-togglebuttonbar-control/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        .myCustomLinkButtonStyleName {
            fontWeight: normal;
        }

        .myCustomButtonStyleName {
            fontWeight: normal;
        }
    &lt;/mx:Style&gt;

    &lt;mx:Array id="arr"&gt;
        &lt;mx:Object label="One" /&gt;
        &lt;mx:Object label="Two" /&gt;
        &lt;mx:Object label="Three" /&gt;
        &lt;mx:Object label="Four" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:LinkBar id="linkBar"
            dataProvider="{arr}"
            linkButtonStyleName="myCustomLinkButtonStyleName" /&gt;

    &lt;mx:ToggleButtonBar id="toggleButtonBar"
            dataProvider="{arr}"
            buttonStyleName="myCustomButtonStyleName" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/LinkBar_linkButtonStyleName_fontWeight_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/LinkBar_linkButtonStyleName_fontWeight_test/bin/main.html" width="100%" height="150"></iframe></p>
<p>Or, you can set the styles a bit more globally by using the following snippet:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/LinkBar_linkButtonStyleName_fontWeight_test_2/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/01/14/setting-a-labels-font-weight-on-a-flex-linkbar-and-togglebuttonbar-control/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        LinkBar {
            linkButtonStyleName: regularFontWeight;
        }

        ToggleButtonBar {
            buttonStyleName: regularFontWeight;
        }

        .regularFontWeight {
            fontWeight: normal;
        }
    &lt;/mx:Style&gt;

    &lt;mx:Array id="arr"&gt;
        &lt;mx:Object label="One" /&gt;
        &lt;mx:Object label="Two" /&gt;
        &lt;mx:Object label="Three" /&gt;
        &lt;mx:Object label="Four" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:LinkBar id="linkBar"
            dataProvider="{arr}" /&gt;

    &lt;mx:ToggleButtonBar id="toggleButtonBar"
            dataProvider="{arr}" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/LinkBar_linkButtonStyleName_fontWeight_test_2/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/LinkBar_linkButtonStyleName_fontWeight_test_2/bin/main.html" width="100%" height="150"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting a label\&#039;s font weight on a Flex LinkBar and ToggleButtonBar control on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/01/14/setting-a-labels-font-weight-on-a-flex-linkbar-and-togglebuttonbar-control/',contentID: 'post-449',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'buttonStyleName,fontWeight,linkButtonStyleName',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/01/14/setting-a-labels-font-weight-on-a-flex-linkbar-and-togglebuttonbar-control/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Creating a vertical ToggleButtonBar in Flex</title>
		<link>http://blog.flexexamples.com/2007/08/22/creating-a-vertical-togglebuttonbar-in-flex/</link>
		<comments>http://blog.flexexamples.com/2007/08/22/creating-a-vertical-togglebuttonbar-in-flex/#comments</comments>
		<pubDate>Wed, 22 Aug 2007 15:18:56 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[ToggleButtonBar]]></category>
		<category><![CDATA[ViewStack]]></category>
		<category><![CDATA[toggleOnClick]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/22/creating-a-vertical-togglebuttonbar-in-flex/</guid>
		<description><![CDATA[<p>The following example creates a ToggleButtonBar control in Flex and sets its toggleOnClick property to true.</p> <p>According to the Flex 2.0.1 documentation:</p> <p> If you set the toggleOnClick property of the ToggleButtonBar container to true, selecting the currently selected button deselects it. By default the toggleOnClick property is set to false. </p> <p>You can check [...]]]></description>
			<content:encoded><![CDATA[<p>The following example creates a ToggleButtonBar control in Flex and sets its <code>toggleOnClick</code> property to true.</p>
<p>According to the Flex 2.0.1 documentation:</p>
<blockquote><p>
If you set the <code>toggleOnClick</code> property of the ToggleButtonBar container to <code>true</code>, selecting the currently selected button deselects it. By default the <code>toggleOnClick</code> property is set to <code>false</code>.
</p></blockquote>
<p>You can check out the different behaviors of the <code>toggleOnClick</code> property by selecting or deselecting the check box in the upper left corner. Likewise, you can change the ToggleButtonBar control&#8217;s <code>direction</code> property by changing the selected value in the combo box in the upper-right corner. If the <code>toggleOnClick</code> property is set to <code>true</code> and you deselect a button in the ToggleButtonBar control, the ToggleButtonBar control&#8217;s <code>selectedIndex</code> property is set to -1 and the Flex application sets the ViewStack container&#8217;s <code>visible</code> property to <code>false</code>.</p>
<p>Full code after the jump.</p>
<p><span id="more-110"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/ToggleButtonBar_toggleOnClick_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/08/22/creating-a-vertical-togglebuttonbar-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:CheckBox id="checkBox"
                label="toggleOnClick"
                selected="true" /&gt;

        &lt;mx:Label text="selectedIndex: {toggleButtonBar.selectedIndex}"
                textAlign="center"
                width="100%" /&gt;

        &lt;mx:Label text="direction:" /&gt;
        &lt;mx:ComboBox id="comboBox"
                change="toggleButtonBar.direction = comboBox.selectedLabel"&gt;
            &lt;mx:dataProvider&gt;
                &lt;mx:Array&gt;
                    &lt;mx:Object label="horizontal" /&gt;
                    &lt;mx:Object label="vertical" /&gt;
                &lt;/mx:Array&gt;
            &lt;/mx:dataProvider&gt;
        &lt;/mx:ComboBox&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:HBox&gt;
        &lt;mx:ToggleButtonBar id="toggleButtonBar"
                dataProvider="{viewStack}"
                toggleOnClick="{checkBox.selected}" /&gt;

        &lt;mx:ViewStack id="viewStack"
                width="160"
                height="120"
                visible="{toggleButtonBar.selectedIndex &gt; -1}"&gt;
            &lt;mx:Canvas label="Red" backgroundColor="red" /&gt;
            &lt;mx:Canvas label="Orange" backgroundColor="haloOrange" /&gt;
            &lt;mx:Canvas label="Yellow" backgroundColor="yellow" /&gt;
            &lt;mx:Canvas label="Green" backgroundColor="haloGreen" /&gt;
            &lt;mx:Canvas label="Blue" backgroundColor="haloBlue" /&gt;
        &lt;/mx:ViewStack&gt;
    &lt;/mx:HBox&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/ToggleButtonBar_toggleOnClick_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/ToggleButtonBar_toggleOnClick_test/bin/main.html" width="100%" height="300"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Creating a vertical ToggleButtonBar in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/08/22/creating-a-vertical-togglebuttonbar-in-flex/',contentID: 'post-110',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'toggleOnClick',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2007/08/22/creating-a-vertical-togglebuttonbar-in-flex/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

