ToolTip causes errorString of parent container to not display

Came across an odd little “bug” today.  Basically what was happening is if you mouse over a control that has a blank tooltip, the events are not propagated to cause the container’s errorString to popup.

So some background on what I was trying to accomplish here.  There was an area of the user interface (UI) where I wanted to flag multiple controls with one errorString so users would know where they can go to not only identify what is having the error, but also where in the UI they can go to resolve the issue.  Here’s what it would look like with an error:

errorString display example

Error control implementation example

I tried to set the errorString for each and every component that I wanted flagged, but this lead to a lot of clutter in the UI.  Not only that, but it would also confuse users about where the error exists as well as what they should change to fix it.  This workflow design has since been used throughout the UI to establish consistency and to clean things up.

Now, what’s different here is that I also wanted to display a toolTip for the DropDownList when there was not any errors to display.  The information what was being displayed further helps users know where that object came from.  Unfortunately setting a toolTip interrupted the event chain for the BorderContainer to know when it should show an errorString popup.  So when a user places their mouse over the DropDownList only the toolTip would be displayed.  The error popup for the BorderContainer does not show up.

Thus enter the art of figuring out how to get it to behave the way I need it to.  My initial gut instinct was that the toolTip was blocking the errorString from appearing.  Once the mouse over events for the DropDownList displayed it’s toolTip, they stopped event propagation.  So the obvious thing is to clear the toolTip, and to do that I’d obviously set the toolTip property to blank using double quotes like this:

control.toolTip = "";

Well, turns out it wasn’t that obvious.  Even though the toolTip was blank, the events were still being blocked from propagating to the parent BorderControl.  So what’s the next best thing to using blank?  A null.  I simply just set the toolTip to null and sure enough everything started to work the way I was intending it to.

control.toolTip = null;
borderContainer.errorString = value;

The oddest thing about this whole situation was that I was unable to find any documentation about this behavior.  It makes perfect sense to prevent the event propagation, otherwise the whole UI will blow up with toolTips and errorStrings.  So, in my situation I wanted the errorString to appear even when users mouse over the DropDownList.  I just needed to figure out how to clear the toolTip and still keep event propagation going so the errorString will appear.  I tried looking at the UIComponent documentation for the “proper” way to clear a toolTip, but didn’t find any documentation for the toolTip property.  The only clue that I has was the default value was shown as “null” (quotes included too, so it’d be a string with a value of ‘null’, but really, we get their point).  This lead me to try setting null as the value to toolTip, and thankfully that did the trick.

Hopefully this will help others who might run into this same situation. I would imagine too this might play a role when people are expecting events in a parent container when the child control has a toolTip set to blank rather than null.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.