Solved

TabBar - enabling itemClick on the selected tab

Posted on 2009-06-29
4
1,189 Views
Last Modified: 2012-05-07
Hey,

This should be fairly simple. I have a TabBar with an itemClick handler that controls a viewstack.
I'm using it for the primary navigation on an application.
Within the viewstack, the user can navigate further into child views, and I want them to be able to click the current tab to return to the root view for that tab as this is the natural choice.
However, the itemClick event is disabled on the selected tab in TabBar. I'm sure there is a simple option to re-enable it, but I can't find it. toggleOnClick would seem like an obvious candidate, but no joy.
....

			private function primaryTabsItemClickHandler(e:Object):void

			{

				if (e.index == 1 && businessGroups != null)

				{

					businessGroups.businessGroupViewStack.selectedIndex = 0;

				}

				primaryViewStack.selectedIndex = e.index;

			}

....
 
 

				<mx:TabBar id="primaryTabs" styleName="PrimaryTabs" tabStyleName="PrimaryTabsTab" itemClick="primaryTabsItemClickHandler(event)">

					<mx:dataProvider>

						<mx:Array>

							<mx:String>MY TASKS</mx:String>

							<mx:String>CHANNELS</mx:String>

							<mx:String>MY TIMESHEETS</mx:String>

						</mx:Array>

					</mx:dataProvider>

				</mx:TabBar>

			<mx:ViewStack id="primaryViewStack" width="100%" height="100%"

				backgroundColor="#FFFFFF" borderSides="left,right,bottom" borderStyle="solid" paddingBottom="15" paddingLeft="15" paddingRight="15"

				paddingTop="15">

.....

Open in new window

0
Comment
Question by:azaram
  • 2
  • 2
4 Comments
 
LVL 37

Accepted Solution

by:
zzynx earned 500 total points
ID: 24752002
>> I'm sure there is a simple option to re-enable it, but I can't find it.
I wouldn't be sure of that. The help flex clearly states: the itemClick event is "dispatched when a tab navigation item is selected".
But you can't select a tab that is already selected, so...

Some ideas:
1) You could try to catch the mouseDown event. Then of course you still have to determine if that mouse click was on the right tab.
2) Maybe some kind of a "Home" button inside the tab panel isn't a bad idea.
3) You could also try to add some sort of breadcrumb control in the top of the panel.
0
 

Author Comment

by:azaram
ID: 24801537
Thanks for the tips.
After some further consideration though, I've decided that it's better to run with a group of primary navigation buttons. I had considered breadcrumbs, but that doesn't solve the default use case of someone clicking a tab and expecting to see the root of its content.
Using buttons has allowed me to do something else I wanted to do - a shortcut menu of items relevant to the logged in user that drops down from one of the buttons in the form of a PopupButton.
0
 

Author Comment

by:azaram
ID: 24801540
Thanks for the tips.
After some further consideration though, I've decided that it's better to run with a group of primary navigation buttons. I had considered breadcrumbs, but that doesn't solve the default use case of someone clicking a tab and expecting to see the root of its content.
Using buttons has allowed me to do something else I wanted to do - a shortcut menu of items relevant to the logged in user that drops down from one of the buttons in the form of a PopupButton.
0
 
LVL 37

Expert Comment

by:zzynx
ID: 24801556
Thanx 4 axxepting and good luck with it
0

Featured Post

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now