My implementation is a little different, but it is an extension of Jewel's 
control and I don't know if it is the right thing to do:

public class ToolTipJwExt extends org.apache.royale.jewel.beads.controls.ToolTip
        {
                
                public function ToolTipJwExt()
                {
                        super();
                }

                /**
                 * @private
                 * @royaleignorecoercion org.apache.royale.core.IUIBase
                 * @royaleignorecoercion 
org.apache.royale.events.IEventDispatcher
                 */
                override protected function 
rollOverHandler(event:MouseEvent):void
                {
                        if( !_onlyIfItOverflows || (_onlyIfItOverflows && 
isOverflowing()) )
                        {
                                super.rollOverHandler(event);
                        }
                }

                private var _onlyIfItOverflows:Boolean = false;
                public function get onlyIfItOverflows():Boolean{ return 
_onlyIfItOverflows; }
                public function set onlyIfItOverflows(value:Boolean):void{ 
_onlyIfItOverflows = value; }

                public function isOverflowing():Boolean
                {
                        var scrollArea:HTMLElement = (_strand as 
IStyledUIBase).element;
                        return scrollArea.offsetWidth < 
scrollArea.scrollWidth?true:false;
                }

        }

How do you see it?, the implementation is different and only for Jewel. 

Hiedra

-----Mensaje original-----
De: Harbs <harbs.li...@gmail.com> 
Enviado el: martes, 19 de abril de 2022 11:05
Para: Apache Royale Development <dev@royale.apache.org>
Asunto: Re: ToolTip bead only if overflowing

FYI, in case it’s useful here’s the implementation I have in one of my apps:

                private var toolTipBead:AdaptiveToolTipBead;

                public function get toolTip():String
                {
                        return toolTipBead.toolTip;
                }

                public function set toolTip(value:String):void
                {
                        toolTipBead.toolTip = value;
                }
                private function titleHover(ev:*):void
                {
                        if(prefUtils.assetSize > _title.element.scrollWidth){
                                // remove the bead
                                if(toolTipBead){
                                        toolTip = '';
                                        _title.removeBead(toolTipBead);
                                        toolTipBead = null;
                                }
                        } else if(!toolTipBead){
                                // add the bead
                                toolTipBead = new AdaptiveToolTipBead();
                                _title.addBead(toolTipBead);
                                toolTip = title;
                                var newEv:Event = 
MouseEvent.createMouseEvent("mouseenter") as Event;
                                _title.element.dispatchEvent(newEv)
                        }
                }

> On Apr 19, 2022, at 10:38 AM, Yishay Weiss <yishayj...@hotmail.com> wrote:
> 
> Sounds good to me.
> 
> From: Maria Jose Esteve<mailto:mjest...@iest.com>
> Sent: Tuesday, April 19, 2022 12:54 AM
> To: dev@royale.apache.org<mailto:dev@royale.apache.org>
> Subject: ToolTip bead only if overflowing
> 
> Hello, do you think a ToolTip bead that only appears if the text really 
> overflows would be of general interest?
> 
> Hiedra
> 

Reply via email to