12 Replies Latest reply on Dec 2, 2008 7:09 AM by Newsgroup_User

    Flickering tooltip in bottom right corner

    aperitech
      I implemented a custom tooltip using the IToolTip interface and DataGrid. This worked well, but the problem is that when the tooltip tries to popup in the bottom right corner of the window it gets into a loop where it appears and disappears (the cursor is over the DataGrid when it appears). Does anyone have any ideas about why this is happening?

      My goal is to have a tooltip that displays some data with Name/Value pairs in two columns. If anyone has any alternate implementation ideas please let me know.
        • 1. Re: Flickering tooltip in bottom right corner
          Level 7

          "aperitech" <webforumsuser@macromedia.com> wrote in message
          news:gg3u9f$f0u$1@forums.macromedia.com...
          >I implemented a custom tooltip using the IToolTip interface and DataGrid.
          >This
          > worked well, but the problem is that when the tooltip tries to popup in
          > the
          > bottom right corner of the window it gets into a loop where it appears and
          > disappears (the cursor is over the DataGrid when it appears). Does anyone
          > have
          > any ideas about why this is happening?
          >
          > My goal is to have a tooltip that displays some data with Name/Value pairs
          > in
          > two columns. If anyone has any alternate implementation ideas please let
          > me
          > know.

          Does the same thing happen with the default tooltip renderers?


          • 2. Re: Flickering tooltip in bottom right corner
            aperitech Level 1
            No, the default tooltip will position the tooltip so that it is just inside the bounds of the window, in the lower right hand corner. It's only with my custom tooltip, installed via the ToolTipManager, where this is a problem.
            • 3. Re: Flickering tooltip in bottom right corner
              Level 7

              "aperitech" <webforumsuser@macromedia.com> wrote in message
              news:gg47g1$qc5$1@forums.macromedia.com...
              > No, the default tooltip will position the tooltip so that it is just
              > inside the
              > bounds of the window, in the lower right hand corner. It's only with my
              > custom
              > tooltip, installed via the ToolTipManager, where this is a problem.

              Maybe if you posted your code it would be easier to discover the problem...


              • 4. Re: Flickering tooltip in bottom right corner
                aperitech Level 1
                Here's the code. You need to scroll vertically and horizontally (unless you have immense screen resolution) to get to the button which will end up at the bottom right corner of the browser window. Hover over it and you'll see the flashy tooltip.
                • 5. Re: Flickering tooltip in bottom right corner
                  Level 7

                  "aperitech" <webforumsuser@macromedia.com> wrote in message
                  news:gg741k$kbv$1@forums.macromedia.com...
                  > Here's the code. You need to scroll vertically and horizontally (unless
                  > you
                  > have immense screen resolution) to get to the button which will end up at
                  > the
                  > bottom right corner of the browser window. Hover over it and you'll see
                  > the
                  > flashy tooltip.
                  >
                  > <?xml version="1.0" encoding="utf-8"?>
                  > <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
                  > layout="absolute"
                  > applicationComplete="init();">
                  >
                  > <mx:HBox id="outerBox" x="2000" y="2000" >
                  > <mx:Button label="Hover over me" toolTip="blah"/>
                  > </mx:HBox>
                  >
                  > <mx:Script>
                  > <![CDATA[
                  > import mx.managers.ToolTipManager;
                  >
                  > private function init():void {
                  > ToolTipManager.toolTipClass = BuggyToolTip;
                  > }
                  >
                  > ]]>
                  > </mx:Script>
                  > </mx:Application>
                  >
                  >
                  >
                  > package {
                  > import mx.containers.Canvas;
                  > import mx.controls.Label;
                  > import mx.core.IToolTip;
                  > import mx.managers.ToolTipManager;
                  >
                  > public class BuggyToolTip extends Canvas implements IToolTip {
                  >
                  > private var _label:Label;
                  >
                  > public function BuggyToolTip() {
                  > super();
                  > _label = new Label();
                  > _label.width = 400;
                  > _label.height = 400;
                  > _label.opaqueBackground = "0x99cc00";
                  > }
                  >
                  > override protected function createChildren():void {
                  > super.createChildren();
                  > addChild(_label);
                  > }
                  >
                  > public function get text():String { return null; }
                  >
                  > public function set text( value:String ):void {}
                  > }
                  > }

                  Not sure how much it matters, but try creating the child in createChildren
                  and setting its properties in commitProperties(), also try setActualSize()
                  instead of width and height. You also may want to inspect the Framework
                  ToolTip code to see if it has special handling for this.

                  HTH;

                  Amy


                  • 6. Re: Flickering tooltip in bottom right corner
                    aperitech Level 1
                    A couple of updates. First I've included code which better represents what I'm trying to do, which is have a tooltip with a DataGrid inside. The flickering still occurs even with this simplest possible example. It appears like the call to createChildren is happening repeatedly. I put a break point in such that I could see the stack in a call to createChildren that was not the first iteration. Here it is..

                    Main Thread (Suspended)
                    BuggyToolTip/createChildren
                    mx.core::UIComponent/initialize
                    mx.core::Container/initialize
                    mx.managers::SystemManager/ http://www.adobe.com/2006/flex/mx/internal::childAdded
                    mx.managers::SystemManager/ http://www.adobe.com/2006/flex/mx/internal::rawChildren_addChildAt
                    mx.managers::SystemChildrenList/addChild
                    mx.managers::ToolTipManagerImpl/ http://www.adobe.com/2006/flex/mx/internal::createTip
                    mx.managers::ToolTipManagerImpl/ http://www.adobe.com/2006/flex/mx/internal::targetChanged
                    mx.managers::ToolTipManagerImpl/ http://www.adobe.com/2006/flex/mx/internal::checkIfTargetChanged
                    mx.managers::ToolTipManagerImpl/ http://www.adobe.com/2006/flex/mx/internal::toolTipMouseOverHandler

                    It appears like the toolTipMouseOverHandler is being invoked repeatedly when the tooltip appears? Also previousTarget is null in targetChanged, thus causing the tooltip to be created again.
                    • 7. Re: Flickering tooltip in bottom right corner
                      Level 7

                      "aperitech" <webforumsuser@macromedia.com> wrote in message
                      news:ggupee$luj$1@forums.macromedia.com...
                      >A couple of updates. First I've included code which better represents what
                      >I'm
                      > trying to do, which is have a tooltip with a DataGrid inside. The
                      > flickering
                      > still occurs even with this simplest possible example. It appears like
                      > the
                      > call to createChildren is happening repeatedly. I put a break point in
                      > such
                      > that I could see the stack in a call to createChildren that was not the
                      > first
                      > iteration. Here it is..

                      You've set c as a static variable, which means it's getting set by any
                      instance of your tooltip that gets created. Were you expecting that there
                      would ever only be one tooltip instance created for the entire lifetime of
                      your app?


                      • 8. Re: Flickering tooltip in bottom right corner
                        aperitech Level 1
                        Yes, I did that for debugging purposes so I could set a breakpoint. I was imagining that each flicker is creating a new tooltip instance and I wanted the counter to be "global" for any/all tooltip instances that were created. I wanted to see the stack after the first creation (i.e. the bug conditions).
                        • 9. Re: Flickering tooltip in bottom right corner
                          rtalton Level 4
                          I think the "flickering" is caused by by a continuous stream of mouseOver/mouseOut events on the button. It's looping.
                          e.g:
                          Mouse moves over button
                          mouseOver event is thrown
                          Tooltip is displayed
                          mouseOut event is thrown
                          Tooltip is hidden
                          mouseOver event is thrown
                          etc.

                          So you've got to keep the canvas or datagrid from covering the button, and hence throwing the mouseOut event.
                          OR
                          Handle the mouseEvent for the button and somehow block the looping behavior.
                          • 10. Re: Flickering tooltip in bottom right corner
                            aperitech Level 1
                            Yes, I think you are correct. It seems like the ToolTipManager class should be smart enough to popup the tooltip in a different orientation in order to avoid it coming up in such a way as to trigger the flurry of mouseOut events. How would I go about installing a custom ToolTipManager implementation? I'm also thinking this would qualify as a bug in the framework code as well?
                            • 11. Re: Flickering tooltip in bottom right corner
                              rtalton Level 4
                              The createToolTip() method of ToolTipManager allows you to specify x/y coordinates for the tooltip. Not sure how you'd implement this in your custom class...
                              • 12. Re: Flickering tooltip in bottom right corner
                                Level 7

                                "aperitech" <webforumsuser@macromedia.com> wrote in message
                                news:gh1i8u$8ic$1@forums.macromedia.com...
                                > Yes, I think you are correct. It seems like the ToolTipManager class
                                > should be
                                > smart enough to popup the tooltip in a different orientation in order to
                                > avoid
                                > it coming up in such a way as to trigger the flurry of mouseOut events.
                                > How
                                > would I go about installing a custom ToolTipManager implementation? I'm
                                > also
                                > thinking this would qualify as a bug in the framework code as well?

                                You said that this doesn't happen with the default tooltip. If you look at
                                the code for that component, maybe you'll see what they did to handle this.