![]() |
![]() |
||||||
|
|||||||
| Tags: |
![]() |
|
|||
|
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. |
| Sponsored Links |
|
|||
|
"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? |
|
|||
|
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. |
|
|||
|
"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... |
|
|||
|
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 {} } } |
|
|||
|
"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 |
|
|||
|
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/20 06/flex/mx/internal::childAdd ed mx.managers::SystemManager/http://www.adobe.com/20 06/flex/mx/internal::rawChild ren_addChildAt mx.managers::SystemChildrenList/addChild mx.managers::ToolTipManagerImpl/http://www.adobe.c om/2006/flex/mx/internal::cre ateTip mx.managers::ToolTipManagerImpl/http://www.adobe.c om/2006/flex/mx/internal::tar getChanged mx.managers::ToolTipManagerImpl/http://www.adobe.c om/2006/flex/mx/internal::che ckIfTargetChanged mx.managers::ToolTipManagerImpl/http://www.adobe.c om/2006/flex/mx/internal::too lTipMouseOverHandler 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. package { import mx.containers.Canvas; import mx.controls.DataGrid; import mx.core.IToolTip; public class BuggyToolTip extends Canvas implements IToolTip { private var _dataGrid ataGrid;private static var c:int = 0; public function BuggyToolTip() { super(); } override protected function createChildren():void { super.createChildren(); _dataGrid = new DataGrid(); if(c > 10) { trace(); } c++; addChild(_dataGrid); } public function get text():String { return null; } public function set text( value:String ):void {} } } |
|
|||
|
"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? |
|
|||
|
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). |
|
|||
|
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. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
- Contact Us
-|-
Adobe Dreamweaver Forums -|-
Archive -|-
Top -|-Rules/Disclaimer-|-Help/Support-|-Advertise