Creating A Flex ButtonBar That Displays Tool Tips

I was recently trying to get a mx:ButtonBar to display a tool tip for each button. I was following the instructions provided in the Flex 2.01 Developer's Guide, where it describes using an array of Objects, with each Object having a label, tooltip, and icon field. However, my tool tips were not showing up.

After some testing, I learned that the tooltip field must be named "toolTip" (note the second T is upper case) and not "tooltip" as the Flex documentation stated. Once I made that change, my tool tips appeared.

You can display a test of this by visiting my button bar example. Right click on the example application to view the source. You'll see that the first array of Objects (dp1) that is the data provider for the top mx:ButtonBar uses "toolTip" as the field name. The second array of Objects (dp2) that is the data provider for the bottom mx:ButtonBar uses "tooltip" as the field name.

If you mouse over the top ButtonBar's buttons you'll see the tool tip. If you mouse over the bottom bar's buttons, you don't see the tool tip.

I've posted a comment about this to the Flex Developer's Guide LiveDocs.

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Perfect timing! I was looking at how to do this only yesterday! Thanks.
# Posted By Jamie Badman | 2/21/07 2:34 AM
It is very much "toolTip" from starting version, also.

I don't found wrong in that.
# Posted By M | 3/1/07 5:48 AM
I've run into an issue using the dataProvider for the buttonBar.

I have 5 buttons using icons which works fine. The issue is that I cannot programmatically enable/disable individual buttons on the bar. The syntax is either not documented or it is not consistent.

Basically, if a user does some action on a panel then I want to disable/enable certain buttons on the buttonBar.

Any ideas?

Many thanks!
# Posted By Rhys Jones | 10/10/07 10:45 AM
Rhys - I've not had to enable/disable buttons on the ButtonBar. My only suggestion is to examine class ButtonBar in the Flex 2.0.1 Language Reference (see adobe.com/flex) to see if there is some way you can get a reference to individual buttons being displayed by the button bar. Then you may be able to use class Buttons enable property.
# Posted By Bruce | 10/11/07 6:56 AM
Rhys:

If you have a buttonbar named monthButtons and you want to enable/disable one of the twelve buttons you can do this:

//This enables the 4th button (0 is the first button):
Button( monthButtons.getChildAt( 3 )).enabled = true;

//This disables the 5th button:
Button( monthButtons.getChildAt( 6 )).enabled = false;

p.s. Bruce, email address validator doesn't allow the plus sign when it is a valid character for an email address. Just FYI.
# Posted By Grant Shearer | 11/27/07 11:07 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.9.1.002. Contact Blog Owner