Simple monkey patch to fix ToolTipManager.toolTipClass
ToolTipManager.toolTipClass doesn't work in Flex 3.0 out of the box. While its intent of allowing you to specify a custom IToolTip implementation is great, ToolTipManagerImpl simply acts as if the property doesn't exist and instantiates an instance of ToolTip. Luckily, the fix is quite easy if you are willing to do a bit of monkey patching. You just have to make a slight modification to the createToolTip() method, making it look like the following:
errorTipBorderStyle:String = null,
context:IUIComponent = null):IToolTip
{
// ***** USE THE PROPERTY! *****
var toolTip:IToolTip = new ToolTipManager.toolTipClass();
var sm:ISystemManager = context ?
context.systemManager :
ApplicationGlobals.application.systemManager;
sm.toolTipChildren.addChild(UIComponent(toolTip));
if (errorTipBorderStyle)
{
UIComponent(toolTip).setStyle("styleName", "errorTip");
UIComponent(toolTip).setStyle("borderStyle", errorTipBorderStyle);
}
toolTip.text = text;
sizeTip(toolTip);
toolTip.move(x, y);
// Ensure that tip is on screen?
// Should x and y for error tip be tip of pointy border?
// show effect?
return toolTip;
}
Here is a diff of the base and updated classes.
As an aside, an easier fix is said to exist here, but it doesn't seem to work when calling ToolTipManager.createToolTip() directly, which is what I needed to do. If you are using toolTips normally by just setting the toolTip property I would recommend trying Peter's fix first.
I would also like to go on record that I hate the *Impl naming convention. Despite what Theo says, I like my interfaces with I's. *Impl just seems kludgy and redundant, and it reminds me of AS2.
Both comments and pings are currently closed.
