Display ToolTips for Combobox List items in Flex.

Note:Hello Readers, This post has some Bugs,so i will solve them ASAP and will make an update.My apologies for a buggy post.Meanwhile if anyone of you find a trick or tip please share them on the post.I appreciate for your feedback.Having said that, i am not disabling the code and demo, you can still access them and contribute.Thanks.

One of the readers asked this question, Is it possible to show ToolTips for the Combobox List items [on mouse over on each item i would like to show a ToolTip]?, and my answer was “YES”.And this post tells about that.

The First thing we got to remember here is the ToolTipManager Class and its methods.Basic information on how to create tooltips using this Class.

[showmyads]

The ToolTipManager has two methods that let you programmatically use ToolTips. These methods are createToolTip() and destroyToolTip(), which you use to create and destroy new ToolTip objects. When you create a ToolTip object, you can customize it as you would any object, with access to its properties, styles, events, and effects.

[So explore more about this ToolTipManager Class to learn more], now we know how to create ToolTips using this Class, but how to show on the Combobox List items ?.Its simple using the ListEvent Class and on ListEvent.ITEM_ROLL_OVER raise an Event and write your code on the eventhandler to create tooltip.Check on the below code sample for this.And destroy the created tooltip on ListEvent.ITEM_ROLL_OUT.Isn’t that simple.

Run demo.

1.Download source code. –>This is with the itemRollOver,itemRollOut properties.

2.Download source code. –>This is with the addEventListener().

Enjoy the post.

Advertisements

20 Responses to Display ToolTips for Combobox List items in Flex.

  1. norberto says:

    Hi, i use your code with item rollover, and i find a little bug, when you display the combobox, and use the mouse wheel, the tooltip is not destroyed.

    thanks

    Saludos desde México

  2. norberto says:

    One detail, only happen if the combo have scroll bar

  3. Alpana says:

    Hi

    Your code has been very helpful to me.
    Just a suggestion. In code with itemRollOver, calling fnDesToolTip on close ensures that tooltip is destroyed on closing the combobox.

    Thanks

  4. kishorekuamru says:

    Hi kumar, Nice post 🙂 it really helps and I got the need exactly.
    I will appreciate if you upload the fixed version, b’ze I found that tool tip is not destroying when we click an particular item.

  5. Jayaprakash says:

    Hi,

    Am facing an issue on this. If i focus any value and use mouse wheel to roll the tooltip will display for all values. Am getting more than one tooltip

    Thanks,
    Prakash

  6. sabeerdeen says:

    Code works fine.. but if there are more items in combo box following error occurs:
    1) multiple tooltip appears(if mouse wheel used )
    2) multiple tooltip appears(if combo box item selcted)

  7. DoRReand says:

    Can anyone recommend the top Script Deployment tool for a small IT service company like mine? Does anyone use Kaseya.com or GFI.com? How do they compare to these guys I found recently: N-able N-central network policy enforcement
    ? What is your best take in cost vs performance among those three? I need a good advice please… Thanks in advance!

  8. Club Penguin says:

    You should try to make some top 10 style posts or something like it

  9. Esha says:

    For displaying tooltips in the combobox just put itemRenderer=”mx.controls.Label”

    eg

    This should work fine.

  10. […] ToolTips for Combobox List items in Flex4 Few months back i made this post in Flex3, it was buggy and i figured later it may not be possible here with my logic.Then comes […]

  11. MIke says:

    got it:

    import mx.managers.ToolTipManager;

    private var tip:ToolTip;
    private var blnShowTip:Boolean=true;

    private function ItemRollOver(event:ListEvent):void {
    var currComboBox:ComboBox = event.currentTarget as ComboBox;
    var tipInfo:String = peCtrler_cb.dataProvider[event.rowIndex].label;

    if (blnShowTip==true){
    tip = ToolTipManager.createToolTip(tipInfo,this.mouseX – 120,this.mouseY) as ToolTip;
    blnShowTip=false;
    }else{
    ToolTipManager.destroyToolTip(tip);
    tip = ToolTipManager.createToolTip(tipInfo,this.mouseX – 120,this.mouseY) as ToolTip;
    }

    }

    private function ItemRollOut(event:Event):void {

    ToolTipManager.destroyToolTip(tip);
    blnShowTip=true

    }

  12. Shrikant says:

    I want to display the tooltip for Datechooser in flex which should be custom how should do this. Please help.

  13. matcullen says:

    after ToolTipManager.destroyToolTip(tip);
    you have to set tip = null;
    otherwise it doesn’t work well

  14. developer'S says:

    the best way to show tooltips, thanks, ^-^

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: