1. #1
    Sencha User
    Join Date
    Jun 2008
    Posts
    43
    Vote Rating
    0
    soulgen is on a distinguished road

      0  

    Default How do I show all component's tooltip using a single button click?

    How do I show all component's tooltip using a single button click?


    Yup, I put a tooltip for each components, and I want to show those all tooltips with a single button click.

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,505
    Vote Rating
    52
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Add this override:

    Code:
    Ext.override(Ext.Element, {
    
        fireEvent: (function() {
            var HTMLEvts = /^(scroll|resize|load|unload|abort|error)$/,
                mouseEvts = /^(click|dblclick|mousedown|mouseup|mouseover|mouseout|contextmenu|mousenter|mouseleave)$/,
                UIEvts = /^(focus|blur|select|change|reset|keypress|keydown|keyup)$/,
                onPref = /^on/;
    
            return Ext.isIE ? function(e) {
                e = e.toLowerCase();
                if (!onPref.test(e)) {
                    e = 'on' + e;
                }
                this.dom.fireEvent(e, document.createEventObject());
            } : function(e) {
                e = e.toLowerCase();
                e.replace(onPref, '');
                var evt;
                if (mouseEvts.test(e)) {
                    var b = this.getBox(),
                        x = b.x + b.width / 2,
                        y = b.y + b.height / 2;
                    evt = document.createEvent("MouseEvents");
                    evt.initMouseEvent(e, true, true, window, (e=='dblclick')?2:1, x, y, x, y, false, false, false, false, 0, null);
                } else if (UIEvts.test(e)) {
                    evt = document.createEvent("UIEvents");
                    evt.initUIEvent(e, true, true, window, 0);
                } else if (HTMLEvts.test(e)) {
                    evt = document.createEvent("HTMLEvents");
                    evt.initEvent(e, true, true);
                }
                if (evt) {
                    this.dom.dispatchEvent(evt);
                }
            }
        })()
    });
    Then iterate through all your Components calling

    Code:
    myComponent.getEl().fireEvent("mouseover");

Similar Threads

  1. How to show the tooltip of button with a long width but a short text?
    By zch_heero in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 24 May 2010, 10:52 PM
  2. how to show button tooltip
    By lalit_ce in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 12 Jun 2009, 6:55 AM
  3. Tooltip in status bar button show navigator scroll
    By hlimaiem in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 27 Mar 2009, 11:55 PM
  4. show gridpanel using button click
    By lalit_ce in forum Ext 2.x: Help & Discussion
    Replies: 6
    Last Post: 6 Oct 2008, 11:52 PM
  5. Replies: 2
    Last Post: 23 Aug 2007, 8:50 PM

Thread Participants: 1